This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the EGCS project.
#pragma poison patch.
- To: Dave Brolley <brolley@cygnus.com>, Per Bothner <bothner@cygnus.com>, Torbjorn Granlund <tege@swox.com>, Gavin Koch <gavin@cygnus.com>
- Subject: #pragma poison patch.
- From: Geoff Keating <geoffk@ozemail.com.au>
- Date: Sat, 31 Jul 1999 14:28:55 +1000
- CC: gcc-patches@gcc.gnu.org
This is a greatly improved version of the #pragma poison
implementation that some might have seen before. Among the other new
features, it comes with documentation, a testcase, syntax checking,
and it works in cpplib.
OK to install?
--
Geoffrey Keating <geoffk@cygnus.com>
===File ~/patches/cygnus/pragma-poison-1.patch==============
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/ChangeLog Sat Jul 31 01:02:06 1999
+++ egcs/gcc/ChangeLog Sat Jul 31 01:06:31 1999
@@ -0,0 +1,25 @@
+Sat Jul 31 00:08:05 1999 Geoffrey Keating <geoffk@cygnus.com>
+
+ * Makefile.in (cppexp.o): Depend on cpphash.h.
+ * cppexp.c (cpp_lex): Handle `defined (xxx)' for poisoned xxx.
+ Include cpphash.h.
+ * cpphash.c (special_symbol): Handle plain `xxx' for poisoned xxx.
+ * cpplib.c (do_define): Generalise to handle poisoned definitions,
+ redefining poisoned identifiers, etc.
+ (do_undef): Don't allow poisoned identifiers to be undefined.
+ (do_pragma): Add #pragma poison.
+ (do_xifdef): Handle `#ifdef xxx' for poisoned xxx.
+
+ * cccp.c: Add T_POISON node type.
+ (special_symbol): Handle `defined(xxx)' and plain `xxx' for
+ poisoned xxx.
+ (do_define): Generalise to handle poisoned definitions,
+ redefining poisoned identifiers, etc.
+ (do_undef): Don't allow poisoned identifiers to be undefined.
+ (do_pragma): Add #pragma poison.
+ (do_xifdef): Handle `#ifdef xxx' for poisoned xxx.
+
+ * c-pragma.c (handle_pragma_token): Ignore #pragma poison.
+ * c-pragma.h: Add ps_poison state. We now always have generic
+ pragmas.
+
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/testsuite/gcc.c-torture/ChangeLog Sat Jul 31 01:02:08 1999
+++ egcs/gcc/testsuite/gcc.c-torture/ChangeLog Sat Jul 31 01:07:09 1999
@@ -0,0 +1,5 @@
+1999-97-31 Geoffrey Keating <geoffk@cygnus.com>
+
+ * noncompile/noncompile.exp: Add poison-1.c.
+ * noncompile/poison-1.c: New file.
+
Changed files:
egcs/gcc/ChangeLog
egcs/gcc/testsuite/gcc.c-torture/ChangeLog
egcs/gcc/Makefile.in
egcs/gcc/c-pragma.c
egcs/gcc/c-pragma.h
egcs/gcc/cccp.c
egcs/gcc/cpp.texi
egcs/gcc/cppexp.c
egcs/gcc/cpphash.c
egcs/gcc/cppinit.c
egcs/gcc/cpplib.c
egcs/gcc/cpplib.h
egcs/gcc/testsuite/gcc.c-torture/noncompile/noncompile.exp
egcs/gcc/testsuite/gcc.c-torture/noncompile/poison-1.c
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/Makefile.in Mon Jul 26 16:22:12 1999
+++ egcs/gcc/Makefile.in Fri Jul 30 21:19:44 1999
@@ -2000,7 +2000,7 @@ LIBCPP_OBJS = cpplib.o cpphash.o cppallo
cpphash.o: cpphash.c $(CONFIG_H) cpplib.h intl.h system.h cpphash.h
cppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h intl.h system.h
cpperror.o: cpperror.c $(CONFIG_H) cpplib.h intl.h system.h
-cppexp.o: cppexp.c $(CONFIG_H) cpplib.h intl.h system.h
+cppexp.o: cppexp.c $(CONFIG_H) cpplib.h intl.h system.h cpphash.h
cppfiles.o: cppfiles.c $(CONFIG_H) cpplib.h intl.h system.h
cppinit.o: cppinit.c $(CONFIG_H) cpplib.h intl.h system.h \
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/c-pragma.c Thu Jul 22 12:45:36 1999
+++ egcs/gcc/c-pragma.c Sat Jul 31 00:10:21 1999
@@ -301,6 +301,10 @@ handle_pragma_token (string, token)
ret_val = 1; /* Ignore the pragma. */
break;
#endif /* HANDLE_PRAGMA_WEAK */
+
+ case ps_poison:
+ ret_val = 1;
+ break;
}
type = state = ps_start;
@@ -339,9 +343,11 @@ handle_pragma_token (string, token)
#ifdef HANDLE_PRAGMA_WEAK
if (strcmp (string, "weak") == 0)
type = state = ps_weak;
-#endif
+#endif
+ if (strcmp (string, "poison") == 0)
+ type = state = ps_poison;
break;
-
+
#ifdef HANDLE_PRAGMA_WEAK
case ps_weak:
name = permalloc (strlen (string) + 1);
@@ -486,7 +492,12 @@ handle_pragma_token (string, token)
state = ps_bad;
break;
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
-
+
+ case ps_poison:
+ if (token && TREE_CODE (token) != IDENTIFIER_NODE)
+ state = ps_bad;
+ break;
+
case ps_bad:
case ps_done:
break;
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/c-pragma.h Thu Jul 22 12:45:36 1999
+++ egcs/gcc/c-pragma.h Fri Jul 30 15:21:23 1999
@@ -61,13 +61,12 @@ extern int add_weak PROTO((char *, char
#endif /* HANDLE_PRAGMA_WEAK */
-#if defined HANDLE_PRAGMA_PACK || defined HANDLE_PRAGMA_WEAK
/* Define HANDLE_GENERIC_PRAGMAS if any kind of front-end pragma
parsing is to be done. The code in GCC's generic C source files
will only look for the definition of this constant. They will
- ignore definitions of HANDLE_PRAGMA_PACK and so on. */
+ ignore definitions of HANDLE_PRAGMA_PACK and so on.
+ With #pragma poison, this is always set. */
#define HANDLE_GENERIC_PRAGMAS 1
-#endif
#ifdef HANDLE_GENERIC_PRAGMAS
@@ -91,6 +90,7 @@ enum pragma_state
ps_push, ps_pushcomma, ps_pushid, ps_pushcomma2,
ps_pop, ps_popcomma,
#endif
+ ps_poison,
ps_bad
};
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/cccp.c Thu Jul 22 12:46:01 1999
+++ egcs/gcc/cccp.c Sat Jul 31 00:00:45 1999
@@ -634,6 +634,7 @@ enum node_type {
T_DISABLED, /* macro temporarily turned off for rescan */
T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */
T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
+ T_POISON, /* defined with `#pragma poison' */
T_UNUSED /* Used for something not defined. */
};
@@ -4252,7 +4253,12 @@ special_symbol (hp, op)
|| (hp->type == T_MACRO && hp->value.defn->predefined)))
/* Output a precondition for this macro use. */
fprintf (pcp_outfile, "#define %s\n", hp->name);
- buf = " 1 ";
+ if (hp->type == T_POISON) {
+ error("attempt to use poisoned `%s'.", hp->name);
+ buf = " 0 ";
+ } else {
+ buf = " 1 ";
+ }
}
else
if (pcp_outfile && pcp_inside_if) {
@@ -4273,6 +4279,11 @@ special_symbol (hp, op)
}
break;
+ case T_POISON:
+ error("attempt to use poisoned `%s'.", hp->name);
+ buf = " 0 "; /* Consider poisoned symbol to not be defined */
+ break;
+
oops:
error ("`defined' without an identifier");
@@ -5895,6 +5906,7 @@ do_define (buf, limit, op, keyword)
{
int hashcode;
MACRODEF mdef;
+ enum node_type newtype = keyword->type == T_DEFINE ? T_MACRO : T_POISON;
/* If this is a precompiler run (with -pcp) pass thru #define directives. */
if (pcp_outfile && op)
@@ -5913,35 +5925,50 @@ do_define (buf, limit, op, keyword)
/* Redefining a precompiled key is ok. */
if (hp->type == T_PCSTRING)
ok = 1;
+ /* Redefining a poisoned identifier is even worse than `not ok'. */
+ else if (hp->type == T_POISON)
+ ok = -1;
+ /* Poisoning anything else is not ok.
+ The poison should always come first. */
+ else if (newtype == T_POISON)
+ ok = 0;
/* Redefining a macro is ok if the definitions are the same. */
else if (hp->type == T_MACRO)
ok = ! compare_defs (mdef.defn, hp->value.defn);
/* Redefining a constant is ok with -D. */
else if (hp->type == T_CONST)
ok = ! done_initializing;
- /* Print the warning if it's not ok. */
- if (!ok) {
- /* If we are passing through #define and #undef directives, do
- that for this re-definition now. */
- if (debug_output && op)
- pass_thru_directive (buf, limit, op, keyword);
-
- pedwarn ("`%.*s' redefined", mdef.symlen, mdef.symnam);
- if (hp->type == T_MACRO)
- pedwarn_with_file_and_line (hp->value.defn->file,
- hp->value.defn->file_len,
- hp->value.defn->line,
- "this is the location of the previous definition");
- }
- /* Replace the old definition. */
- hp->type = T_MACRO;
- hp->value.defn = mdef.defn;
+
+ /* Print the warning or error if it's not ok. */
+ if (ok <= 0)
+ {
+ /* If we are passing through #define and #undef directives, do
+ that for this re-definition now. */
+ if (debug_output && op)
+ pass_thru_directive (buf, limit, op, keyword);
+
+ if (hp->type == T_POISON)
+ error ("redefining poisoned `%.*s'", mdef.symlen, mdef.symnam);
+ else
+ pedwarn ("`%.*s' redefined", mdef.symlen, mdef.symnam);
+ if (hp->type == T_MACRO)
+ pedwarn_with_file_and_line (hp->value.defn->file,
+ hp->value.defn->file_len,
+ hp->value.defn->line,
+ "this is the location of the previous definition");
+ }
+ if (hp->type != T_POISON)
+ {
+ /* Replace the old definition. */
+ hp->type = newtype;
+ hp->value.defn = mdef.defn;
+ }
} else {
/* If we are passing through #define and #undef directives, do
that for this new definition now. */
if (debug_output && op)
pass_thru_directive (buf, limit, op, keyword);
- install (mdef.symnam, mdef.symlen, T_MACRO,
+ install (mdef.symnam, mdef.symlen, newtype,
(char *) mdef.defn, hashcode);
}
}
@@ -6962,9 +6989,13 @@ do_undef (buf, limit, op, keyword)
need to pass through all effective #undef directives. */
if (debug_output && op)
pass_thru_directive (orig_buf, limit, op, keyword);
- if (hp->type != T_MACRO)
- warning ("undefining `%s'", hp->name);
- delete_macro (hp);
+ if (hp->type == T_POISON)
+ error ("cannot undefine poisoned `%s'", hp->name);
+ else {
+ if (hp->type != T_MACRO)
+ warning ("undefining `%s'", hp->name);
+ delete_macro (hp);
+ }
}
if (pedantic) {
@@ -7070,9 +7101,9 @@ do_ident (buf, limit, op, keyword)
static int
do_pragma (buf, limit, op, keyword)
- U_CHAR *buf, *limit ATTRIBUTE_UNUSED;
- FILE_BUF *op ATTRIBUTE_UNUSED;
- struct directive *keyword ATTRIBUTE_UNUSED;
+ U_CHAR *buf, *limit;
+ FILE_BUF *op;
+ struct directive *keyword;
{
SKIP_WHITE_SPACE (buf);
if (!strncmp ((char *) buf, "once", 4)) {
@@ -7083,6 +7114,29 @@ do_pragma (buf, limit, op, keyword)
do_once ();
}
+ if (!strncmp (buf, "poison", 6)) {
+ /* Poison these symbols so that all subsequent usage produces an
+ error message. */
+ U_CHAR *p = buf + 6;
+
+ SKIP_WHITE_SPACE (p);
+ while (p < limit)
+ {
+ U_CHAR *end = p;
+
+ while (end < limit && is_idchar[*end])
+ end++;
+ if (end < limit && !is_space[*end])
+ {
+ error ("invalid #pragma poison");
+ return 0;
+ }
+ do_define(p, end, op, keyword);
+ p = end;
+ SKIP_WHITE_SPACE (p);
+ }
+ }
+
if (!strncmp ((char *) buf, "implementation", 14)) {
/* Be quiet about `#pragma implementation' for a file only if it hasn't
been included yet. */
@@ -7332,6 +7386,10 @@ do_xifdef (buf, limit, op, keyword)
}
}
+ if ((hp != NULL) && (hp->type == T_POISON)) {
+ error("attempt to use poisoned `%s'.", hp->name);
+ hp = NULL;
+ }
skip = (hp == NULL) ^ (keyword->type == T_IFNDEF);
if (start_of_file && !skip) {
control_macro = (U_CHAR *) xmalloc (end - buf + 1);
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/cpp.texi Thu Jul 22 12:46:39 1999
+++ egcs/gcc/cpp.texi Fri Jul 30 20:53:59 1999
@@ -550,6 +550,7 @@ in the C preprocessor.
* Concatenation:: Building tokens from parts taken from macro arguments.
* Undefining:: Cancelling a macro's definition.
* Redefining:: Changing a macro's definition.
+* Poisoning:: Ensuring a macro is never defined or used.
* Macro Pitfalls:: Macros can confuse the unwary. Here we explain
several common problems and strange features.
@end menu
@@ -1308,7 +1309,7 @@ The same form of @samp{#undef} directive
arguments or definitions that don't expect arguments. The @samp{#undef}
directive has no effect when used on a name not currently defined as a macro.
-@node Redefining, Macro Pitfalls, Undefining, Macros
+@node Redefining, Poisoning, Undefining, Macros
@subsection Redefining Macros
@cindex redefining macros
@@ -1342,7 +1343,28 @@ where there was no whitespace at all.
Recall that a comment counts as whitespace.
-@node Macro Pitfalls,, Redefining, Macros
+@node Poisoning, Macro Pitfalls, Redefining, Macros
+@subsection Poisoning Macros
+@cindex poisoning macros
+
+Sometimes, there is an identifier that you want to remove completely
+from your program, and make sure that it never creeps back in. To
+enforce this, the @samp{#pragma poison} directive can be used.
+@samp{#pragma poison} is followed by a list of identifiers to poison,
+and takes effect for the rest of the source. You cannot @samp{#undef} a
+poisoned identifier or test to see if it's defined with @samp{#ifdef}.
+
+For example,
+
+@example
+#pragma poison printf sprintf fprintf
+sprintf(some_string, "hello");
+@end example
+
+@noindent
+will produce an error.
+
+@node Macro Pitfalls,, Poisoning, Macros
@subsection Pitfalls and Subtleties of Macros
@cindex problems with macros
@cindex pitfalls of macros
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/cppexp.c Thu Jul 22 12:46:40 1999
+++ egcs/gcc/cppexp.c Fri Jul 30 21:19:20 1999
@@ -27,6 +27,7 @@ Written by Per Bothner 1994. */
#include "config.h"
#include "system.h"
#include "cpplib.h"
+#include "cpphash.h"
#ifdef MULTIBYTE_CHARS
#include <locale.h>
@@ -441,6 +442,7 @@ cpp_lex (pfile, skip_evaluation)
int paren = 0, len;
cpp_buffer *ip = CPP_BUFFER (pfile);
U_CHAR *tok;
+ HASHNODE *hp;
cpp_skip_hspace (pfile);
if (*ip->cur == '(')
@@ -465,9 +467,14 @@ cpp_lex (pfile, skip_evaluation)
goto oops;
++ip->cur;
}
- if (cpp_lookup (pfile, tok, len, -1))
- op.value = 1;
-
+ hp = cpp_lookup (pfile, tok, len, -1);
+ if (hp != NULL)
+ {
+ if (hp->type == T_POISON)
+ cpp_error (pfile, "attempt to use poisoned `%s'", hp->name);
+ else
+ op.value = 1;
+ }
}
return op;
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/cpphash.c Thu Jul 22 12:46:44 1999
+++ egcs/gcc/cpphash.c Fri Jul 30 19:30:04 1999
@@ -1011,6 +1011,13 @@ special_symbol (hp, pfile)
return;
}
+ case T_POISON:
+ cpp_error (pfile, "attempt to use poisoned `%s'.", hp->name);
+ CPP_RESERVE (pfile, 1);
+ CPP_PUTC_Q (pfile, '0');
+ CPP_NUL_TERMINATE_Q (pfile);
+ break;
+
default:
cpp_fatal (pfile, "cpplib internal error: invalid special hash type");
return;
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/cpplib.c Tue Jul 27 19:02:44 1999
+++ egcs/gcc/cpplib.c Sat Jul 31 00:56:01 1999
@@ -604,8 +604,9 @@ check_macro_name (pfile, symname, assert
}
/* Process a #define command.
-KEYWORD is the keyword-table entry for #define,
-or NULL for a "predefined" macro. */
+ KEYWORD is the keyword-table entry for #define,
+ or NULL for a "predefined" macro,
+ or the keyword-table entry for #pragma in the case of a #pragma poison. */
static int
do_define (pfile, keyword)
@@ -617,10 +618,16 @@ do_define (pfile, keyword)
HASHNODE *hp;
long here;
U_CHAR *macro, *buf, *end;
+ enum node_type new_type;
here = CPP_WRITTEN (pfile);
copy_rest_of_line (pfile);
+ if (keyword == NULL || keyword->type == T_DEFINE)
+ new_type = T_MACRO;
+ else
+ new_type = T_POISON;
+
/* Copy out the line so we can pop the token buffer. */
buf = pfile->token_buffer + here;
end = CPP_PWRITTEN (pfile);
@@ -642,30 +649,40 @@ do_define (pfile, keyword)
/* Redefining a precompiled key is ok. */
if (hp->type == T_PCSTRING)
ok = 1;
+ /* Redefining a poisoned identifier is even worse than `not ok'. */
+ else if (hp->type == T_POISON)
+ ok = -1;
/* Redefining a macro is ok if the definitions are the same. */
else if (hp->type == T_MACRO)
ok = ! compare_defs (pfile, mdef.defn, hp->value.defn);
/* Redefining a constant is ok with -D. */
else if (hp->type == T_CONST || hp->type == T_STDC)
ok = ! CPP_OPTIONS (pfile)->done_initializing;
- /* Print the warning if it's not ok. */
- if (!ok)
+ /* Print the warning or error if it's not ok. */
+ if (ok <= 0)
{
- cpp_pedwarn (pfile, "`%.*s' redefined", mdef.symlen, mdef.symnam);
+ if (hp->type == T_POISON)
+ cpp_error (pfile, "redefining poisoned `%.*s'",
+ mdef.symlen, mdef.symnam);
+ else
+ cpp_pedwarn (pfile, "`%.*s' redefined", mdef.symlen, mdef.symnam);
if (hp->type == T_MACRO)
cpp_pedwarn_with_file_and_line (pfile, hp->value.defn->file,
hp->value.defn->line,
"this is the location of the previous definition");
}
- /* Replace the old definition. */
- hp->type = T_MACRO;
- hp->value.defn = mdef.defn;
+ if (hp->type != T_POISON)
+ {
+ /* Replace the old definition. */
+ hp->type = new_type;
+ hp->value.defn = mdef.defn;
+ }
}
else
- cpp_install (pfile, mdef.symnam, mdef.symlen, T_MACRO,
+ cpp_install (pfile, mdef.symnam, mdef.symlen, new_type,
(char *) mdef.defn, hashcode);
- if (keyword)
+ if (keyword != NULL && keyword->type == T_DEFINE)
{
if (CPP_OPTIONS (pfile)->debug_output
|| CPP_OPTIONS (pfile)->dump_macros == dump_definitions)
@@ -1363,9 +1380,14 @@ do_undef (pfile, keyword)
need to pass through all effective #undef commands. */
if (CPP_OPTIONS (pfile)->debug_output && keyword)
pass_thru_directive (name, sym_length, pfile, keyword);
- if (hp->type != T_MACRO)
- cpp_warning (pfile, "undefining `%s'", hp->name);
- delete_macro (hp);
+ if (hp->type == T_POISON)
+ cpp_error (pfile, "cannot undefine poisoned `%s'", hp->name);
+ else
+ {
+ if (hp->type != T_MACRO)
+ cpp_warning (pfile, "undefining `%s'", hp->name);
+ delete_macro (hp);
+ }
}
return 0;
@@ -1517,6 +1539,65 @@ do_pragma (pfile, keyword)
"`#pragma implementation' for `%s' appears after file is included",
fcopy);
}
+ else if (!strncmp (buf, "poison", 6))
+ {
+ /* Poison these symbols so that all subsequent usage produces an
+ error message. */
+ U_CHAR *p = buf + 6;
+ size_t plen;
+ U_CHAR *syms;
+ int writeit;
+
+ SKIP_WHITE_SPACE (p);
+ plen = strlen(p) + 1;
+
+ syms = (U_CHAR *) alloca (plen);
+ memcpy (syms, p, plen);
+
+ /* As a rule, don't include #pragma poison commands in output,
+ unless the user asks for them. */
+ writeit = (CPP_OPTIONS (pfile)->debug_output
+ || CPP_OPTIONS (pfile)->dump_macros == dump_definitions
+ || CPP_OPTIONS (pfile)->dump_macros == dump_names);
+
+ if (writeit)
+ CPP_SET_WRITTEN (pfile, here);
+ else
+ CPP_SET_WRITTEN (pfile, here-8);
+
+ if (writeit)
+ {
+ CPP_RESERVE (pfile, plen + 7);
+ CPP_PUTS_Q (pfile, "poison", 7);
+ }
+
+ while (*syms != '\0')
+ {
+ U_CHAR *end = syms;
+
+ while (is_idchar[*end])
+ end++;
+
+ if (!is_hor_space[*end] && *end != '\0')
+ {
+ cpp_error (pfile, "invalid #pragma poison directive");
+ return 1;
+ }
+
+ if (cpp_push_buffer (pfile, syms, end - syms) != NULL)
+ {
+ do_define (pfile, keyword);
+ cpp_pop_buffer (pfile);
+ }
+ if (writeit)
+ {
+ CPP_PUTC_Q (pfile, ' ');
+ CPP_PUTS_Q (pfile, syms, end - syms);
+ }
+ syms = end;
+ SKIP_WHITE_SPACE (syms);
+ }
+ }
return 0;
}
@@ -1668,6 +1749,11 @@ do_xifdef (pfile, keyword)
{
control_macro = (U_CHAR *) xmalloc (ident_length + 1);
bcopy (ident, control_macro, ident_length + 1);
+ }
+ if (hp != NULL && hp->type == T_POISON)
+ {
+ cpp_error (pfile, "attempt to use poisoned `%s'", hp->name);
+ skip = !skip;
}
}
else
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/cpplib.h Thu Jul 22 12:46:50 1999
+++ egcs/gcc/cpplib.h Fri Jul 30 15:38:14 1999
@@ -600,6 +600,7 @@ enum node_type {
T_MACRO, /* macro defined by `#define' */
T_DISABLED, /* macro temporarily turned off for rescan */
T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
+ T_POISON, /* defined with `#pragma poison' */
T_UNUSED /* Used for something not defined. */
};
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/testsuite/gcc.c-torture/noncompile/noncompile.exp Thu Jul 22 13:08:11 1999
+++ egcs/gcc/testsuite/gcc.c-torture/noncompile/noncompile.exp Sat Jul 31 00:49:17 1999
@@ -312,3 +312,13 @@ set compiler_output ".*:6:"
set groups {passed gcc-noncompile}
postbase $src_code $run $groups
+
+# Test poison-1.c
+prebase
+
+set src_code poison-1.c
+set compiler_output ".*c:2:.*c:4:.*c:5:.*c:7:.*c:8:.*c:9:.*c:11:.*c:12:.*c:13:.*c:14:.*c:17:.*c:20:"
+
+set groups {passed gcc-noncompile}
+
+postbase $src_code $run $groups
--- /dev/null Sat Jul 31 01:12:52 1999
+++ egcs/gcc/testsuite/gcc.c-torture/noncompile/poison-1.c Sat Jul 31 00:07:19 1999
@@ -0,0 +1,22 @@
+#pragma poison foo
+foo
+#pragma poison foo2 foo3
+foo2
+foo3
+#pragma poison foo4 foo5
+foo4
+foo5
+#pragma poison +++
+#define foo6 123
+#pragma poison foo6
+#define foo6 345
+#define foo6 456
+#ifdef foo6
+#error hey! foo6 poisoned!
+#endif
+#if defined(foo6)
+#error no, foo6 still poisoned!
+#else
+foo6
+#endif
+#pragma poison
============================================================