diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/Makefile | 5 | ||||
-rw-r--r-- | posix/annexc.c | 23 |
2 files changed, 12 insertions, 16 deletions
diff --git a/posix/Makefile b/posix/Makefile index ad70fddd63..5eadf35eb7 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -64,7 +64,7 @@ before-compile := testcases.h ptestcases.h # So they get cleaned up. generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \ - $(objpfx)annexc $(objpfx)annexc.out + annexc annexc.out include ../Rules @@ -137,7 +137,8 @@ endif # Run a test on the header files we use. # XXX Please note that for now we ignore the result of this test. tests: $(objpfx)annexc - -$(dir $<)$(notdir $<) '$(CC)' '-I../include -I../include -I.. $(+sysdep-includes) -I../include -I../include -I..' > $<.out + -$(dir $<)$(notdir $<) '$(CC)' \ + '-I../include -I.. $(+sysdep-includes)' > $<.out $(objpfx)annexc: annexc.c $(native-compile) diff --git a/posix/annexc.c b/posix/annexc.c index dbc5e28520..8b95311314 100644 --- a/posix/annexc.c +++ b/posix/annexc.c @@ -609,12 +609,12 @@ static struct header /* Format string to build command to invoke compiler. */ static const char fmt[] = "\ echo \"#include <%s>\" |\ -%s -E -dM -D_POSIX_SOURCE %s \ +%s -E -dM -D_POSIX_SOURCE -D_LIBC %s \ -isystem `%s --print-prog-name=include` - > %s"; static const char testfmt[] = "\ echo \"#include <unistd.h>\n#ifndef %s\n#error not defined\n#endif\n\" |\ -%s -E -dM -D_POSIX_SOURCE %s \ +%s -E -dM -D_POSIX_SOURCE -D_LIBC %s \ -isystem `%s --print-prog-name=include` - 2> /dev/null > %s"; @@ -709,7 +709,7 @@ get_null_defines (void) while (fgets (line, sizeof line, input) != NULL) { - char *start, *end; + char *start; if (strlen (line) < 9 || line[7] != ' ') { /* "#define A" */ printf ("Malformed input, expected '#define MACRO'\ngot '%s'\n", @@ -730,9 +730,7 @@ get_null_defines (void) } } start = &line[8]; - for (end = start + 1; !isspace (*end) && *end != '\0'; ++end) - ; - result[result_len++] = xstrndup (start, end - start); + result[result_len++] = xstrndup (start, strcspn (start, " (")); if (first) { @@ -809,7 +807,6 @@ check_header (const struct header *header, const char **except) while (fgets (line, sizeof line, input) != NULL) { - char *endmac; const char **ignore; if (strlen (line) < 9 || line[7] != ' ') { /* "#define A" */ @@ -819,9 +816,13 @@ check_header (const struct header *header, const char **except) continue; } + /* Find next char after the macro identifier; this can be either + a space or an open parenthesis. */ + line[8 + strcspn (&line[8], " (")] = '\0'; + /* Now check whether it's one of the required macros. */ for (i = 0; i < header->nsyms; ++i) - if (!strncmp (&line[8], header->syms[i], strlen (header->syms[i]))) + if (!strcmp (&line[8], header->syms[i])) break; if (i < header->nsyms) { @@ -833,12 +834,6 @@ check_header (const struct header *header, const char **except) if (line[8] == '_') continue; - /* Find next char after the macro identifier; this can be either - a space or an open parenthesis. */ - endmac = strpbrk (&line[8], " ("); - if (endmac != NULL) - *endmac = '\0'; - /* Maybe one of the symbols which are always defined. */ for (ignore = except; *ignore != NULL; ++ignore) if (! strcmp (&line[8], *ignore)) |