From 24b4b8b66366176b40525baa1b2f056e8a68d0ce Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 3 Nov 2016 20:19:02 +0100 Subject: argp: be sure uClibc-ng feature is available --- test/argp/argp-ex1.c | 6 ++++++ test/argp/argp-ex2.c | 6 ++++++ test/argp/argp-ex3.c | 7 +++++++ test/argp/argp-ex4.c | 6 ++++++ test/argp/argp-test.c | 6 ++++++ test/argp/bug-argp1.c | 7 ++++++- test/argp/tst-argp1.c | 12 ++++++++---- test/argp/tst-argp2.c | 6 ++++++ test/math/libm-test.inc | 2 +- 9 files changed, 52 insertions(+), 6 deletions(-) diff --git a/test/argp/argp-ex1.c b/test/argp/argp-ex1.c index 7bb5f22..5a4f93b 100644 --- a/test/argp/argp-ex1.c +++ b/test/argp/argp-ex1.c @@ -6,10 +6,16 @@ a (rather pointless) messages for --help. */ #include +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) #include +#endif int main (int argc, char **argv) { +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) argp_parse (0, argc, argv, 0, 0, 0); exit (0); +#else + return 23; +#endif } diff --git a/test/argp/argp-ex2.c b/test/argp/argp-ex2.c index c49fbac..67c9b4b 100644 --- a/test/argp/argp-ex2.c +++ b/test/argp/argp-ex2.c @@ -20,6 +20,7 @@ parsers for various tasks). */ #include +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) #include const char *argp_program_version = @@ -37,9 +38,14 @@ static char doc[] = used in the output for @samp{--help}, and the @samp{--version} option will print out @code{argp_program_version}. */ static struct argp argp = { 0, 0, 0, doc }; +#endif int main (int argc, char **argv) { +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) argp_parse (&argp, argc, argv, 0, 0, 0); exit (0); +#else + return 23; +#endif } diff --git a/test/argp/argp-ex3.c b/test/argp/argp-ex3.c index 24d5c50..6e24fe8 100644 --- a/test/argp/argp-ex3.c +++ b/test/argp/argp-ex3.c @@ -53,6 +53,7 @@ An options vector should be terminated by an option with all fields zero. */ #include +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) #include const char *argp_program_version = @@ -129,8 +130,11 @@ parse_opt (int key, char *arg, struct argp_state *state) /* Our argp parser. */ static struct argp argp = { options, parse_opt, args_doc, doc }; +#endif + int main (int argc, char **argv) { +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) struct arguments arguments; /* Default values. */ @@ -150,4 +154,7 @@ int main (int argc, char **argv) arguments.silent ? "yes" : "no"); exit (0); +#else + return 23; +#endif } diff --git a/test/argp/argp-ex4.c b/test/argp/argp-ex4.c index c77c7ef..97097c7 100644 --- a/test/argp/argp-ex4.c +++ b/test/argp/argp-ex4.c @@ -25,6 +25,7 @@ #include #include +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) #include const char *argp_program_version = @@ -130,9 +131,11 @@ parse_opt (int key, char *arg, struct argp_state *state) /* Our argp parser. */ static struct argp argp = { options, parse_opt, args_doc, doc }; +#endif int main (int argc, char **argv) { +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) int i, j; struct arguments arguments; @@ -164,4 +167,7 @@ int main (int argc, char **argv) } exit (0); +#else + return 23; +#endif } diff --git a/test/argp/argp-test.c b/test/argp/argp-test.c index 2e0c749..b0ad59b 100644 --- a/test/argp/argp-test.c +++ b/test/argp/argp-test.c @@ -24,6 +24,7 @@ #include #include #include +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) #include const char *argp_program_version = "argp-test 1.0"; @@ -195,14 +196,19 @@ static struct argp_child argp_children[] = { { &sub_argp }, { 0 } }; static struct argp argp = { options, parse_opt, args_doc, doc, argp_children, help_filter }; +#endif int main (int argc, char **argv) { +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) struct params params; params.foonly = 0; params.foonly_default = random (); argp_parse (&argp, argc, argv, 0, 0, ¶ms); printf ("After parsing: foonly = %x\n", params.foonly); return 0; +#else + return 23; +#endif } diff --git a/test/argp/bug-argp1.c b/test/argp/bug-argp1.c index a28cf4b..39b573d 100644 --- a/test/argp/bug-argp1.c +++ b/test/argp/bug-argp1.c @@ -1,6 +1,6 @@ +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) #include - static const struct argp_option test_options[] = { { NULL, 'a', NULL, OPTION_DOC, NULL }, @@ -13,13 +13,18 @@ static struct argp test_argp = test_options }; +#endif static int do_test (int argc, char *argv[]) { +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) int i; argp_parse (&test_argp, argc, argv, 0, &i, NULL); return 0; +#else + return 23; +#endif } #define TEST_FUNCTION do_test (argc, argv) diff --git a/test/argp/tst-argp1.c b/test/argp/tst-argp1.c index 912e0cb..c3be15d 100644 --- a/test/argp/tst-argp1.c +++ b/test/argp/tst-argp1.c @@ -16,11 +16,9 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, see .  */ +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) #include - - - #define OPT_TO_THREAD 300 #define OPT_TO_PROCESS 301 #define OPT_SYNC_SIGNAL 302 @@ -90,11 +88,12 @@ static struct argp argp = { test_options, parse_opt }; - +#endif static int do_test (void) { +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) int argc = 2; char *argv[3] = { (char *) "tst-argp1", (char *) "--help", NULL }; int remaining; @@ -103,15 +102,20 @@ do_test (void) argp_parse (&argp, argc, argv, 0, &remaining, NULL); return 0; +#else + return 23; +#endif } +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) /* Handle program arguments. */ static error_t parse_opt (int key, char *arg, struct argp_state *state) { return ARGP_ERR_UNKNOWN; } +#endif #define TEST_FUNCTION do_test () #include "../test-skeleton.c" diff --git a/test/argp/tst-argp2.c b/test/argp/tst-argp2.c index 03afc0b..0e521a9 100644 --- a/test/argp/tst-argp2.c +++ b/test/argp/tst-argp2.c @@ -16,6 +16,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, see .  */ +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) #include static const struct argp_option opt1[] = @@ -87,12 +88,17 @@ static struct argp argp1 = opt1, NULL, "args doc1", "doc1", children1, NULL, NULL }; +#endif static int do_test (void) { +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2"); return 0; +#else + return 23; +#endif } diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc index 2fc97ee..ee86c8c 100644 --- a/test/math/libm-test.inc +++ b/test/math/libm-test.inc @@ -118,7 +118,7 @@ #include #include #include -#if defined(__GLIBC__) || defined(__UCLIBC__) && defined(__UCLIBC_HAS_FENV__) +#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_FENV__) #include #else #include "fenv.h" -- cgit v1.2.3