Skip to content

Commit 6efcb6d

Browse files
authored
bpo-32030: Fix compilation on FreeBSD, #include <fenv.h> (python#4919)
* main.c: add missing #include <fenv.h> on FreeBSD * indent also other #ifdef in main.c * cleanup Programs/python.c
1 parent d757aaf commit 6efcb6d

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

Modules/main.c

+14-10
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,27 @@
99
#include <locale.h>
1010

1111
#if defined(MS_WINDOWS) || defined(__CYGWIN__)
12-
#include <windows.h>
13-
#ifdef HAVE_IO_H
14-
#include <io.h>
15-
#endif
16-
#ifdef HAVE_FCNTL_H
17-
#include <fcntl.h>
18-
#endif
12+
# include <windows.h>
13+
# ifdef HAVE_IO_H
14+
# include <io.h>
15+
# endif
16+
# ifdef HAVE_FCNTL_H
17+
# include <fcntl.h>
18+
# endif
1919
#endif
2020

2121
#ifdef _MSC_VER
22-
#include <crtdbg.h>
22+
# include <crtdbg.h>
23+
#endif
24+
25+
#ifdef __FreeBSD__
26+
# include <fenv.h>
2327
#endif
2428

2529
#if defined(MS_WINDOWS)
26-
#define PYTHONHOMEHELP "<prefix>\\python{major}{minor}"
30+
# define PYTHONHOMEHELP "<prefix>\\python{major}{minor}"
2731
#else
28-
#define PYTHONHOMEHELP "<prefix>/lib/pythonX.X"
32+
# define PYTHONHOMEHELP "<prefix>/lib/pythonX.X"
2933
#endif
3034

3135
#define COPYRIGHT \

Programs/python.c

-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
/* Minimal main program -- everything is loaded from the library */
22

33
#include "Python.h"
4-
#include "internal/pystate.h"
5-
#include <locale.h>
6-
7-
#ifdef __FreeBSD__
8-
#include <fenv.h>
9-
#endif
104

115
#ifdef MS_WINDOWS
126
int
@@ -15,8 +9,6 @@ wmain(int argc, wchar_t **argv)
159
return Py_Main(argc, argv);
1610
}
1711
#else
18-
19-
2012
int
2113
main(int argc, char **argv)
2214
{

0 commit comments

Comments
 (0)