Move feature macro before "config.h" include

This allows to use header includes in "config.h" to reduce the build
configuration checks.

Update #3818.
This commit is contained in:
Sebastian Huber
2019-11-27 12:02:45 +01:00
parent ae716da79f
commit 8f6b7abd1a
28 changed files with 71 additions and 47 deletions

View File

@@ -13,12 +13,12 @@
* http://www.rtems.org/license/LICENSE. * http://www.rtems.org/license/LICENSE.
*/ */
#define _GNU_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <rtems.h> #include <rtems.h>
#include <pthread.h> #include <pthread.h>

View File

@@ -21,12 +21,12 @@
* http://www.rtems.org/license/LICENSE. * http://www.rtems.org/license/LICENSE.
*/ */
#define _GNU_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _GNU_SOURCE
#include <rtems/test.h> #include <rtems/test.h>
#include <tmacros.h> #include <tmacros.h>

View File

@@ -13,11 +13,12 @@
* http://www.rtems.org/license/LICENSE. * http://www.rtems.org/license/LICENSE.
*/ */
#define _POSIX_26_C_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _POSIX_26_C_SOURCE
#include "tmacros.h" #include "tmacros.h"
#include <errno.h> #include <errno.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>

View File

@@ -7,11 +7,12 @@
* http://www.rtems.org/license/LICENSE. * http://www.rtems.org/license/LICENSE.
*/ */
#define _GNU_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _GNU_SOURCE
#include <tmacros.h> #include <tmacros.h>
#include <errno.h> #include <errno.h>
#include <sched.h> #include <sched.h>

View File

@@ -7,12 +7,12 @@
* http://www.rtems.org/license/LICENSE. * http://www.rtems.org/license/LICENSE.
*/ */
#define _POSIX_26_C_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _POSIX_26_C_SOURCE
#include <devctl.h> #include <devctl.h>
int test( void ); int test( void );

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE 500
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE 500
#include <ftw.h> #include <ftw.h>
int test( void ); int test( void );

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE 500
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE 500
#include <ftw.h> #include <ftw.h>
int test( void ); int test( void );

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _POSIX_C_SOURCE 200809L
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _POSIX_C_SOURCE 200809L
#include <math.h> #include <math.h>
int test( void ); int test( void );

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE 500
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE 500
#include <math.h> #include <math.h>
int test( void ); int test( void );

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _POSIX_C_SOURCE 200809L
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _POSIX_C_SOURCE 200809L
#include <math.h> #include <math.h>
int test( void ); int test( void );

View File

@@ -29,11 +29,13 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _POSIX_C_SOURCE 200809L
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _POSIX_C_SOURCE 200809L
#include <stdio.h> #include <stdio.h>
int test( void ); int test( void );

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _POSIX_C_SOURCE 200809L
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _POSIX_C_SOURCE 200809L
#include <stdio.h> #include <stdio.h>
int test( void ); int test( void );

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _POSIX_C_SOURCE 200809L
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _POSIX_C_SOURCE 200809L
#include <stdio.h> #include <stdio.h>
int test( void ); int test( void );

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE 500
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE 500
#include <stdlib.h> #include <stdlib.h>
int test( void ); int test( void );
@@ -47,4 +48,4 @@ int test( void )
char *valuep; char *valuep;
return_value = getsubopt(&optionp, tokens, &valuep); return_value = getsubopt(&optionp, tokens, &valuep);
return return_value; return return_value;
} }

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE 500
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE 500
#include <stdlib.h> #include <stdlib.h>
int test( void ); int test( void );
@@ -46,4 +47,4 @@ int test( void )
return_value = grantpt(fildes); return_value = grantpt(fildes);
return return_value; return return_value;
} }

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE 600
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE 600
#include <stdlib.h> #include <stdlib.h>
int test( void ); int test( void );
@@ -45,4 +46,4 @@ int test( void )
return_value = posix_openpt(1); return_value = posix_openpt(1);
return (return_value != -1); return (return_value != -1);
} }

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE 500
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE 500
#include <stdlib.h> #include <stdlib.h>
int test( void ); int test( void );
@@ -45,4 +46,4 @@ int test( void )
return_value = (char *)ptsname(1); return_value = (char *)ptsname(1);
return (return_value != NULL); return (return_value != NULL);
} }

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE
#include <stdlib.h> #include <stdlib.h>
int test( void ); int test( void );
@@ -45,4 +46,4 @@ int main( void )
setkey(array); setkey(array);
return 1; return 1;
} }

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE 500
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE 500
#include <stdlib.h> #include <stdlib.h>
int test( void ); int test( void );
@@ -46,4 +47,4 @@ int test( void )
return_value = unlockpt(fd); return_value = unlockpt(fd);
return (return_value != -1); return (return_value != -1);
} }

View File

@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _POSIX_C_SOURCE 200809L
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _POSIX_C_SOURCE 200809L
#include <strings.h> #include <strings.h>
#include <locale.h> #include <locale.h>

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE
#include <sys/msg.h> #include <sys/msg.h>
int test( void ); int test( void );

View File

@@ -30,12 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE #include <sys/msg.h>
#include <sys/msg.h>
int test( void ); int test( void );

View File

@@ -30,16 +30,17 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE_EXTENDED 1
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define STACK_SIZE (1<<15) // 32KiB
#define _XOPEN_SOURCE_EXTENDED 1
#include <ucontext.h> #include <ucontext.h>
#include <stdlib.h> #include <stdlib.h>
#define STACK_SIZE (1<<15) // 32KiB
int test( void ); int test( void );
void func( void ); void func( void );
@@ -63,4 +64,4 @@ int test( void )
void func( void ) void func( void )
{ {
return; return;
} }

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE_EXTENDED 1
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE_EXTENDED 1
#include <ucontext.h> #include <ucontext.h>
int return_value = 0; int return_value = 0;
@@ -54,4 +55,4 @@ void func( void )
{ {
setcontext(ucp); setcontext(ucp);
return_value = 1; return_value = 1;
} }

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE
#include <wchar.h> #include <wchar.h>
int test(void); int test(void);

View File

@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define _XOPEN_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _XOPEN_SOURCE
#include <wchar.h> #include <wchar.h>
int test(void); int test(void);

View File

@@ -12,11 +12,12 @@
* http://www.rtems.org/license/LICENSE. * http://www.rtems.org/license/LICENSE.
*/ */
#define _GNU_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#define _GNU_SOURCE
#include <errno.h> #include <errno.h>
#include <pthread.h> #include <pthread.h>
#include <string.h> #include <string.h>

View File

@@ -12,12 +12,12 @@
* http://www.rtems.org/license/LICENSE. * http://www.rtems.org/license/LICENSE.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define _GNU_SOURCE #define _GNU_SOURCE
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems.h> #include <rtems.h>
#include <rtems/libcsupport.h> #include <rtems/libcsupport.h>