Don't warn about #undef unix, otherwise we can't compile uipc_domain.c

and it can't simply nuked.
This commit is contained in:
enami 1998-09-01 08:39:59 +00:00
parent b742b9ad67
commit d6b993dd4f
3 changed files with 13 additions and 7 deletions

9
gnu/dist/gcc/cccp.c vendored
View File

@ -6870,7 +6870,8 @@ do_undef (buf, limit, op, keyword)
SKIP_WHITE_SPACE (buf); SKIP_WHITE_SPACE (buf);
sym_length = check_macro_name (buf, "macro"); sym_length = check_macro_name (buf, "macro");
while ((hp = lookup (buf, sym_length, -1)) != NULL) { /* pass -2 to indicate that we are going to undefine */
while ((hp = lookup (buf, sym_length, -2)) != NULL) {
/* If we are generating additional info for debugging (with -g) we /* If we are generating additional info for debugging (with -g) we
need to pass through all effective #undef directives. */ need to pass through all effective #undef directives. */
if (debug_output && op) if (debug_output && op)
@ -9460,6 +9461,8 @@ install (name, len, type, value, hash)
* *
* If HASH is >= 0, it is the precomputed hash code. * If HASH is >= 0, it is the precomputed hash code.
* Otherwise, compute the hash code. * Otherwise, compute the hash code.
* If HASH == -1, it is normal lookups. Else, if HASH is -2, it is
* lookups for undef.
*/ */
HASHNODE * HASHNODE *
@ -9470,7 +9473,7 @@ lookup (name, len, hash)
{ {
register U_CHAR *bp; register U_CHAR *bp;
register HASHNODE *bucket; register HASHNODE *bucket;
int hashsave = hash; int islookup = (hash == -1);
static int warned_unix = 0; static int warned_unix = 0;
if (len < 0) { if (len < 0) {
@ -9488,7 +9491,7 @@ lookup (name, len, hash)
bucket = bucket->next; bucket = bucket->next;
} }
/* Lookups pass no hashcode. #define passes one. Look for no hashcode. */ /* Lookups pass no hashcode. #define passes one. Look for no hashcode. */
if ((hashsave < 0) && !strncmp(name, "unix", len) && !warned_unix) { if (islookup && !strncmp(name, "unix", len) && !warned_unix) {
warned_unix++; warned_unix++;
warning("deprecated symbol \"unix\" is no longer predefined"); warning("deprecated symbol \"unix\" is no longer predefined");
} }

View File

@ -54,7 +54,9 @@ hashf (name, len, hashsize)
Otherwise, compute the length by scanning the entire name. Otherwise, compute the length by scanning the entire name.
If HASH is >= 0, it is the precomputed hash code. If HASH is >= 0, it is the precomputed hash code.
Otherwise, compute the hash code. */ Otherwise, compute the hash code.
If HASH == -1, it is normal lookups. Else, if HASH is -2, it is
lookups for undef. */
HASHNODE * HASHNODE *
cpp_lookup (pfile, name, len, hash) cpp_lookup (pfile, name, len, hash)
@ -65,7 +67,7 @@ cpp_lookup (pfile, name, len, hash)
{ {
register const U_CHAR *bp; register const U_CHAR *bp;
register HASHNODE *bucket; register HASHNODE *bucket;
int hashsave = hash; int islookup = (hash == -1);
static int warned_unix = 0; static int warned_unix = 0;
if (len < 0) if (len < 0)
@ -84,7 +86,7 @@ cpp_lookup (pfile, name, len, hash)
bucket = bucket->next; bucket = bucket->next;
} }
/* Lookups pass no hashcode. #define passes one. Look for no hashcode. */ /* Lookups pass no hashcode. #define passes one. Look for no hashcode. */
if ((hashsave < 0) && !strncmp(name, "unix", len) && !warned_unix) { if (islookup && !strncmp(name, "unix", len) && !warned_unix) {
warned_unix++; warned_unix++;
warning("deprecated symbol \"unix\" is no longer predefined"); warning("deprecated symbol \"unix\" is no longer predefined");
} }

View File

@ -3830,7 +3830,8 @@ do_undef (pfile, keyword, buf, limit)
SKIP_WHITE_SPACE (buf); SKIP_WHITE_SPACE (buf);
sym_length = check_macro_name (pfile, buf, "macro"); sym_length = check_macro_name (pfile, buf, "macro");
while ((hp = cpp_lookup (pfile, buf, sym_length, -1)) != NULL) /* pass -2 to indicate that we are going to undefine */
while ((hp = cpp_lookup (pfile, buf, sym_length, -2)) != NULL)
{ {
/* If we are generating additional info for debugging (with -g) we /* If we are generating additional info for debugging (with -g) we
need to pass through all effective #undef commands. */ need to pass through all effective #undef commands. */