Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c57e07

Browse files
author
Vladimir Marangozov
committed
#include reordering so that extern "C" does not interfere with
standard C++ specific includes. Closes patch 101061.
1 parent 1a731c6 commit 2c57e07

1 file changed

Lines changed: 40 additions & 38 deletions

File tree

Include/pyport.h

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,51 @@ Used in: Py_SAFE_DOWNCAST
3737
#include <stdlib.h>
3838
#endif
3939

40+
#include <math.h> /* Moved here from the math section, before extern "C" */
41+
42+
/********************************************
43+
* WRAPPER FOR <time.h> and/or <sys/time.h> *
44+
********************************************/
45+
46+
#ifdef TIME_WITH_SYS_TIME
47+
#include <sys/time.h>
48+
#include <time.h>
49+
#else /* !TIME_WITH_SYS_TIME */
50+
#ifdef HAVE_SYS_TIME_H
51+
#include <sys/time.h>
52+
#else /* !HAVE_SYS_TIME_H */
53+
#include <time.h>
54+
#endif /* !HAVE_SYS_TIME_H */
55+
#endif /* !TIME_WITH_SYS_TIME */
56+
57+
58+
/******************************
59+
* WRAPPER FOR <sys/select.h> *
60+
******************************/
61+
62+
/* NB caller must include <sys/types.h> */
63+
64+
#ifdef HAVE_SYS_SELECT_H
65+
66+
#include <sys/select.h>
67+
68+
#else /* !HAVE_SYS_SELECT_H */
69+
70+
#ifdef USE_GUSI1
71+
/* If we don't have sys/select the definition may be in unistd.h */
72+
#include <GUSI.h>
73+
#endif
74+
75+
#endif /* !HAVE_SYS_SELECT_H */
76+
77+
4078
#ifdef __cplusplus
4179
/* Move this down here since some C++ #include's don't like to be included
4280
inside an extern "C" */
4381
extern "C" {
4482
#endif
4583

84+
4685
/* Py_ARITHMETIC_RIGHT_SHIFT
4786
* C doesn't define whether a right-shift of a signed integer sign-extends
4887
* or zero-fills. Here a macro to force sign extension:
@@ -85,7 +124,6 @@ extern "C" {
85124
#endif
86125

87126

88-
89127
/**************************************************************************
90128
Prototypes that are missing from the standard include files on some systems
91129
(and possibly only some versions of such systems.)
@@ -165,8 +203,6 @@ extern double hypot(double, double);
165203
#endif
166204
#endif
167205

168-
#include <math.h>
169-
170206
#ifndef HAVE_HYPOT
171207
#ifdef __MWERKS__
172208
#undef hypot
@@ -241,41 +277,6 @@ extern double hypot(double, double);
241277
#endif
242278

243279

244-
/********************************************
245-
* WRAPPER FOR <time.h> and/or <sys/time.h> *
246-
********************************************/
247-
248-
#ifdef TIME_WITH_SYS_TIME
249-
#include <sys/time.h>
250-
#include <time.h>
251-
#else /* !TIME_WITH_SYS_TIME */
252-
#ifdef HAVE_SYS_TIME_H
253-
#include <sys/time.h>
254-
#else /* !HAVE_SYS_TIME_H */
255-
#include <time.h>
256-
#endif /* !HAVE_SYS_TIME_H */
257-
#endif /* !TIME_WITH_SYS_TIME */
258-
259-
260-
/******************************
261-
* WRAPPER FOR <sys/select.h> *
262-
******************************/
263-
264-
/* NB caller must include <sys/types.h> */
265-
266-
#ifdef HAVE_SYS_SELECT_H
267-
268-
#include <sys/select.h>
269-
270-
#else /* !HAVE_SYS_SELECT_H */
271-
272-
#ifdef USE_GUSI1
273-
/* If we don't have sys/select the definition may be in unistd.h */
274-
#include <GUSI.h>
275-
#endif
276-
277-
#endif /* !HAVE_SYS_SELECT_H */
278-
279280
/* If the fd manipulation macros aren't defined,
280281
here is a set that should do the job */
281282

@@ -307,6 +308,7 @@ typedef struct fd_set {
307308

308309
#endif /* fd manipulation macros */
309310

311+
310312
#ifdef __cplusplus
311313
}
312314
#endif

0 commit comments

Comments
 (0)