Skip to content

Commit 7f69e44

Browse files
committed
Listen to feature_test_macros(7) with a guard.
If HAVE_CONFIG_H is given (most presumably on the command line) it is safe to include the (#define-only) config.h. On prominent platforms, these defines must precede any inlcudes. To quote feature_test_macros(7) on Linux: > NOTE: In order to be effective, a feature test macro must be defined before including any header files. config.h provides these macros, either manually specified or through means of configuration (eg. autoconf/configure). Having these defines early does not hurt platforms not using this system but is vital on platforms using it.
1 parent 27b632d commit 7f69e44

File tree

1 file changed

+18
-0
lines changed
  • platforms/Cross/vm

1 file changed

+18
-0
lines changed

platforms/Cross/vm/sq.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@
99
#ifndef _SQ_H
1010
#define _SQ_H
1111

12+
13+
#ifdef HAVE_CONFIG_H
14+
/* If HAVE_CONFIG_H is given (most presumably on the command line)
15+
* it is safe to include the (#define-only) config.h.
16+
* On prominent platforms, these defines must precede any inlcudes.
17+
* To quote feature_test_macros(7) on Linux:
18+
* NOTE: In order to be effective, a feature test macro must be defined before including any header files.
19+
*
20+
* config.h provides these macros, either manually specified or
21+
* through means of configuration (eg. autoconf/configure).
22+
*
23+
* Having these defines early does not hurt platforms not using this
24+
* system but is vital on platforms using it. Hence it comes early
25+
*/
26+
#include "config.h"
27+
#endif
28+
29+
1230
#include <stdio.h>
1331
#include <stdlib.h>
1432
#include <string.h>

0 commit comments

Comments
 (0)