[rtems commit] Move feature macro before "config.h" include
Sebastian Huber
sebh at rtems.org
Mon Dec 2 06:47:41 UTC 2019
Module: rtems
Branch: master
Commit: 8f6b7abd1aed966f205cc26e09ef38f9b0d40744
Changeset: http://git.rtems.org/rtems/commit/?id=8f6b7abd1aed966f205cc26e09ef38f9b0d40744
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Nov 27 12:02:45 2019 +0100
Move feature macro before "config.h" include
This allows to use header includes in "config.h" to reduce the build
configuration checks.
Update #3818.
---
testsuites/psxtests/psxclassic01/init.c | 4 ++--
testsuites/psxtests/psxconfig01/init.c | 4 ++--
testsuites/psxtests/psxdevctl01/test.c | 3 ++-
testsuites/psxtests/psxgetattrnp01/init.c | 3 ++-
testsuites/psxtests/psxhdrs/devctl/posix_devctl.c | 4 ++--
testsuites/psxtests/psxhdrs/ftw/ftw.c | 3 ++-
testsuites/psxtests/psxhdrs/ftw/nftw.c | 3 ++-
testsuites/psxtests/psxhdrs/math/y0l.c | 3 ++-
testsuites/psxtests/psxhdrs/math/y1.c | 3 ++-
testsuites/psxtests/psxhdrs/math/y1l.c | 3 ++-
testsuites/psxtests/psxhdrs/stdio/getdelim.c | 4 +++-
testsuites/psxtests/psxhdrs/stdio/getline.c | 3 ++-
testsuites/psxtests/psxhdrs/stdio/renameat.c | 3 ++-
testsuites/psxtests/psxhdrs/stdlib/getsubopt.c | 5 +++--
testsuites/psxtests/psxhdrs/stdlib/grantpt.c | 5 +++--
testsuites/psxtests/psxhdrs/stdlib/posix_openpt.c | 5 +++--
testsuites/psxtests/psxhdrs/stdlib/ptsname.c | 5 +++--
testsuites/psxtests/psxhdrs/stdlib/setkey.c | 5 +++--
testsuites/psxtests/psxhdrs/stdlib/unlockpt.c | 5 +++--
testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c | 4 ++--
testsuites/psxtests/psxhdrs/sys/msg/msgctl.c | 3 ++-
testsuites/psxtests/psxhdrs/sys/msg/msgget.c | 5 +++--
testsuites/psxtests/psxhdrs/ucontext/makecontext.c | 9 +++++----
testsuites/psxtests/psxhdrs/ucontext/setcontext.c | 5 +++--
testsuites/psxtests/psxhdrs/wchar/wcswidth.c | 3 ++-
testsuites/psxtests/psxhdrs/wchar/wcwidth.c | 3 ++-
testsuites/psxtests/psxthreadname01/init.c | 5 +++--
testsuites/sptests/spscheduler01/init.c | 6 +++---
28 files changed, 70 insertions(+), 46 deletions(-)
diff --git a/testsuites/psxtests/psxclassic01/init.c b/testsuites/psxtests/psxclassic01/init.c
index 4711732..42ddf10 100644
--- a/testsuites/psxtests/psxclassic01/init.c
+++ b/testsuites/psxtests/psxclassic01/init.c
@@ -13,12 +13,12 @@
* http://www.rtems.org/license/LICENSE.
*/
+#define _GNU_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <rtems.h>
#include <pthread.h>
diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c
index 2eeacbd..dc90373 100644
--- a/testsuites/psxtests/psxconfig01/init.c
+++ b/testsuites/psxtests/psxconfig01/init.c
@@ -21,12 +21,12 @@
* http://www.rtems.org/license/LICENSE.
*/
+#define _GNU_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _GNU_SOURCE
-
#include <rtems/test.h>
#include <tmacros.h>
diff --git a/testsuites/psxtests/psxdevctl01/test.c b/testsuites/psxtests/psxdevctl01/test.c
index 0fe9d94..ed22ba8 100644
--- a/testsuites/psxtests/psxdevctl01/test.c
+++ b/testsuites/psxtests/psxdevctl01/test.c
@@ -13,11 +13,12 @@
* http://www.rtems.org/license/LICENSE.
*/
+#define _POSIX_26_C_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _POSIX_26_C_SOURCE
#include "tmacros.h"
#include <errno.h>
#include <sys/ioctl.h>
diff --git a/testsuites/psxtests/psxgetattrnp01/init.c b/testsuites/psxtests/psxgetattrnp01/init.c
index 986c650..dca5a25 100644
--- a/testsuites/psxtests/psxgetattrnp01/init.c
+++ b/testsuites/psxtests/psxgetattrnp01/init.c
@@ -7,11 +7,12 @@
* http://www.rtems.org/license/LICENSE.
*/
+#define _GNU_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _GNU_SOURCE
#include <tmacros.h>
#include <errno.h>
#include <sched.h>
diff --git a/testsuites/psxtests/psxhdrs/devctl/posix_devctl.c b/testsuites/psxtests/psxhdrs/devctl/posix_devctl.c
index 3a40c78..db03459 100644
--- a/testsuites/psxtests/psxhdrs/devctl/posix_devctl.c
+++ b/testsuites/psxtests/psxhdrs/devctl/posix_devctl.c
@@ -7,12 +7,12 @@
* http://www.rtems.org/license/LICENSE.
*/
+#define _POSIX_26_C_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _POSIX_26_C_SOURCE
-
#include <devctl.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/ftw/ftw.c b/testsuites/psxtests/psxhdrs/ftw/ftw.c
index 2578d3a..4175716 100644
--- a/testsuites/psxtests/psxhdrs/ftw/ftw.c
+++ b/testsuites/psxtests/psxhdrs/ftw/ftw.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE 500
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE 500
#include <ftw.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/ftw/nftw.c b/testsuites/psxtests/psxhdrs/ftw/nftw.c
index 092851a..e55763c 100644
--- a/testsuites/psxtests/psxhdrs/ftw/nftw.c
+++ b/testsuites/psxtests/psxhdrs/ftw/nftw.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE 500
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE 500
#include <ftw.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/math/y0l.c b/testsuites/psxtests/psxhdrs/math/y0l.c
index c036bcd..4384ada 100644
--- a/testsuites/psxtests/psxhdrs/math/y0l.c
+++ b/testsuites/psxtests/psxhdrs/math/y0l.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _POSIX_C_SOURCE 200809L
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _POSIX_C_SOURCE 200809L
#include <math.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/math/y1.c b/testsuites/psxtests/psxhdrs/math/y1.c
index ea97329..d880728 100644
--- a/testsuites/psxtests/psxhdrs/math/y1.c
+++ b/testsuites/psxtests/psxhdrs/math/y1.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE 500
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE 500
#include <math.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/math/y1l.c b/testsuites/psxtests/psxhdrs/math/y1l.c
index d50925c..48dbaab 100644
--- a/testsuites/psxtests/psxhdrs/math/y1l.c
+++ b/testsuites/psxtests/psxhdrs/math/y1l.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _POSIX_C_SOURCE 200809L
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _POSIX_C_SOURCE 200809L
#include <math.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/stdio/getdelim.c b/testsuites/psxtests/psxhdrs/stdio/getdelim.c
index c4368f9..e1b9149 100644
--- a/testsuites/psxtests/psxhdrs/stdio/getdelim.c
+++ b/testsuites/psxtests/psxhdrs/stdio/getdelim.c
@@ -29,11 +29,13 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
+#define _POSIX_C_SOURCE 200809L
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/stdio/getline.c b/testsuites/psxtests/psxhdrs/stdio/getline.c
index 9427d25..bbbc389 100644
--- a/testsuites/psxtests/psxhdrs/stdio/getline.c
+++ b/testsuites/psxtests/psxhdrs/stdio/getline.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _POSIX_C_SOURCE 200809L
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/stdio/renameat.c b/testsuites/psxtests/psxhdrs/stdio/renameat.c
index 8de1381..ef62a54 100644
--- a/testsuites/psxtests/psxhdrs/stdio/renameat.c
+++ b/testsuites/psxtests/psxhdrs/stdio/renameat.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _POSIX_C_SOURCE 200809L
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/stdlib/getsubopt.c b/testsuites/psxtests/psxhdrs/stdlib/getsubopt.c
index 3d6c09f..172c505 100755
--- a/testsuites/psxtests/psxhdrs/stdlib/getsubopt.c
+++ b/testsuites/psxtests/psxhdrs/stdlib/getsubopt.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE 500
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE 500
#include <stdlib.h>
int test( void );
@@ -47,4 +48,4 @@ int test( void )
char *valuep;
return_value = getsubopt(&optionp, tokens, &valuep);
return return_value;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/stdlib/grantpt.c b/testsuites/psxtests/psxhdrs/stdlib/grantpt.c
index 01c4a19..2ba0ad7 100755
--- a/testsuites/psxtests/psxhdrs/stdlib/grantpt.c
+++ b/testsuites/psxtests/psxhdrs/stdlib/grantpt.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE 500
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE 500
#include <stdlib.h>
int test( void );
@@ -46,4 +47,4 @@ int test( void )
return_value = grantpt(fildes);
return return_value;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/stdlib/posix_openpt.c b/testsuites/psxtests/psxhdrs/stdlib/posix_openpt.c
index acdcc7f..83201aa 100755
--- a/testsuites/psxtests/psxhdrs/stdlib/posix_openpt.c
+++ b/testsuites/psxtests/psxhdrs/stdlib/posix_openpt.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE 600
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE 600
#include <stdlib.h>
int test( void );
@@ -45,4 +46,4 @@ int test( void )
return_value = posix_openpt(1);
return (return_value != -1);
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/stdlib/ptsname.c b/testsuites/psxtests/psxhdrs/stdlib/ptsname.c
index cefdae0..e94ce64 100755
--- a/testsuites/psxtests/psxhdrs/stdlib/ptsname.c
+++ b/testsuites/psxtests/psxhdrs/stdlib/ptsname.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE 500
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE 500
#include <stdlib.h>
int test( void );
@@ -45,4 +46,4 @@ int test( void )
return_value = (char *)ptsname(1);
return (return_value != NULL);
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/stdlib/setkey.c b/testsuites/psxtests/psxhdrs/stdlib/setkey.c
index f7fce84..f7142a0 100755
--- a/testsuites/psxtests/psxhdrs/stdlib/setkey.c
+++ b/testsuites/psxtests/psxhdrs/stdlib/setkey.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE
#include <stdlib.h>
int test( void );
@@ -45,4 +46,4 @@ int main( void )
setkey(array);
return 1;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/stdlib/unlockpt.c b/testsuites/psxtests/psxhdrs/stdlib/unlockpt.c
index c2cf2a7..f60f659 100755
--- a/testsuites/psxtests/psxhdrs/stdlib/unlockpt.c
+++ b/testsuites/psxtests/psxhdrs/stdlib/unlockpt.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE 500
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE 500
#include <stdlib.h>
int test( void );
@@ -46,4 +47,4 @@ int test( void )
return_value = unlockpt(fd);
return (return_value != -1);
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c b/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c
index 01342d3..b9d094d 100644
--- a/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c
+++ b/testsuites/psxtests/psxhdrs/strings/strcasecmp_l.c
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _POSIX_C_SOURCE 200809L
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _POSIX_C_SOURCE 200809L
-
#include <strings.h>
#include <locale.h>
diff --git a/testsuites/psxtests/psxhdrs/sys/msg/msgctl.c b/testsuites/psxtests/psxhdrs/sys/msg/msgctl.c
index 5904df7..6ddd60d 100644
--- a/testsuites/psxtests/psxhdrs/sys/msg/msgctl.c
+++ b/testsuites/psxtests/psxhdrs/sys/msg/msgctl.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE
#include <sys/msg.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/sys/msg/msgget.c b/testsuites/psxtests/psxhdrs/sys/msg/msgget.c
index 688002c..e861798 100644
--- a/testsuites/psxtests/psxhdrs/sys/msg/msgget.c
+++ b/testsuites/psxtests/psxhdrs/sys/msg/msgget.c
@@ -30,12 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE
-#include <sys/msg.h>
+#include <sys/msg.h>
int test( void );
diff --git a/testsuites/psxtests/psxhdrs/ucontext/makecontext.c b/testsuites/psxtests/psxhdrs/ucontext/makecontext.c
index 1149a2c..b180a8e 100755
--- a/testsuites/psxtests/psxhdrs/ucontext/makecontext.c
+++ b/testsuites/psxtests/psxhdrs/ucontext/makecontext.c
@@ -30,16 +30,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE_EXTENDED 1
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define STACK_SIZE (1<<15) // 32KiB
-
-#define _XOPEN_SOURCE_EXTENDED 1
#include <ucontext.h>
#include <stdlib.h>
+#define STACK_SIZE (1<<15) // 32KiB
+
int test( void );
void func( void );
@@ -63,4 +64,4 @@ int test( void )
void func( void )
{
return;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/ucontext/setcontext.c b/testsuites/psxtests/psxhdrs/ucontext/setcontext.c
index d2f2848..3f8cd63 100755
--- a/testsuites/psxtests/psxhdrs/ucontext/setcontext.c
+++ b/testsuites/psxtests/psxhdrs/ucontext/setcontext.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE_EXTENDED 1
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE_EXTENDED 1
#include <ucontext.h>
int return_value = 0;
@@ -54,4 +55,4 @@ void func( void )
{
setcontext(ucp);
return_value = 1;
-}
\ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/wchar/wcswidth.c b/testsuites/psxtests/psxhdrs/wchar/wcswidth.c
index 2f122d5..1657687 100644
--- a/testsuites/psxtests/psxhdrs/wchar/wcswidth.c
+++ b/testsuites/psxtests/psxhdrs/wchar/wcswidth.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE
#include <wchar.h>
int test(void);
diff --git a/testsuites/psxtests/psxhdrs/wchar/wcwidth.c b/testsuites/psxtests/psxhdrs/wchar/wcwidth.c
index 9805b97..75c2157 100644
--- a/testsuites/psxtests/psxhdrs/wchar/wcwidth.c
+++ b/testsuites/psxtests/psxhdrs/wchar/wcwidth.c
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define _XOPEN_SOURCE
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#define _XOPEN_SOURCE
#include <wchar.h>
int test(void);
diff --git a/testsuites/psxtests/psxthreadname01/init.c b/testsuites/psxtests/psxthreadname01/init.c
index 0269e97..ccc2ea1 100644
--- a/testsuites/psxtests/psxthreadname01/init.c
+++ b/testsuites/psxtests/psxthreadname01/init.c
@@ -12,11 +12,12 @@
* http://www.rtems.org/license/LICENSE.
*/
+#define _GNU_SOURCE
+
#ifdef HAVE_CONFIG_H
- #include "config.h"
+#include "config.h"
#endif
-#define _GNU_SOURCE
#include <errno.h>
#include <pthread.h>
#include <string.h>
diff --git a/testsuites/sptests/spscheduler01/init.c b/testsuites/sptests/spscheduler01/init.c
index 04d65fc..f42e60c 100644
--- a/testsuites/sptests/spscheduler01/init.c
+++ b/testsuites/sptests/spscheduler01/init.c
@@ -12,12 +12,12 @@
* http://www.rtems.org/license/LICENSE.
*/
+#define _GNU_SOURCE
+
#ifdef HAVE_CONFIG_H
- #include "config.h"
+#include "config.h"
#endif
-#define _GNU_SOURCE
-
#include <rtems.h>
#include <rtems/libcsupport.h>
More information about the vc
mailing list