Commit c3bf3e6e by Neil Booth Committed by Neil Booth

cpplib.c (cpp_init_internal_pragmas): Remove #pragma poison.

	* cpplib.c (cpp_init_internal_pragmas): Remove #pragma poison.
	* cppmacro.c (paste_all_tokens): Bad pastes are a hard error.
doc:
	* cpp.texi: Update for removal of obsolete features.
testsuite:
	* gcc.dg/cpp/poison.c: Update.
	* gcc.dg/cpp/20000625-2.c: Remove.
	* gcc.dg/cpp/direct2s.c: Remove final test.

From-SVN: r53333
parent 2cb008af
2002-05-09 Neil Booth <neil@daikokuya.demon.co.uk>
* cpplib.c (cpp_init_internal_pragmas): Remove #pragma poison.
* cppmacro.c (paste_all_tokens): Bad pastes are a hard error.
doc:
* cpp.texi: Update for removal of obsolete features.
Thu May 9 07:46:18 2002 Jan Hubicka <jh@suse.cz>
Jeffrey A Law (law@redhat.com)
......
......@@ -1049,7 +1049,6 @@ _cpp_init_internal_pragmas (pfile)
cpp_reader *pfile;
{
/* Pragmas in the global namespace. */
cpp_register_pragma (pfile, 0, "poison", do_pragma_poison);
cpp_register_pragma (pfile, 0, "once", do_pragma_once);
/* New GCC-specific pragmas should be put in the GCC namespace. */
......@@ -1122,8 +1121,8 @@ do_pragma_once (pfile)
check_eol (pfile);
}
/* Handle #pragma poison, to poison one or more identifiers so that
the lexer produces a hard error for each subsequent usage. */
/* Handle #pragma GCC poison, to poison one or more identifiers so
that the lexer produces a hard error for each subsequent usage. */
static void
do_pragma_poison (pfile)
cpp_reader *pfile;
......
......@@ -435,9 +435,9 @@ paste_all_tokens (pfile, lhs)
{
_cpp_backup_tokens (pfile, 1);
/* Mandatory warning for all apart from assembler. */
/* Mandatory error for all apart from assembler. */
if (CPP_OPTION (pfile, lang) != CLK_ASM)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, DL_ERROR,
"pasting \"%s\" and \"%s\" does not give a valid preprocessing token",
cpp_token_as_text (pfile, lhs),
cpp_token_as_text (pfile, rhs));
......
......@@ -176,7 +176,6 @@ Obsolete Features
* Assertions::
* Obsolete once-only headers::
* Miscellaneous obsolete features::
@end detailmenu
@end menu
......@@ -3625,7 +3624,6 @@ In some cases, we plan to remove the feature in a future version of GCC@.
@menu
* Assertions::
* Obsolete once-only headers::
* Miscellaneous obsolete features::
@end menu
@node Assertions
......@@ -3748,41 +3746,6 @@ matter what.
but it is not recognized by all preprocessors, so you cannot rely on it
in a portable program.
@node Miscellaneous obsolete features
@subsection Miscellaneous obsolete features
Here are a few more obsolete features.
@itemize @bullet
@cindex invalid token paste
@item Attempting to paste two tokens which together do not form a valid
preprocessing token.
The preprocessor currently warns about this and outputs the two tokens
adjacently, which is probably the behavior the programmer intends. It
may not work in future, though.
Most of the time, when you get this warning, you will find that @samp{##}
is being used superstitiously, to guard against whitespace appearing
between two tokens. It is almost always safe to delete the @samp{##}.
@cindex pragma poison
@item @code{#pragma poison}
This is the same as @code{#pragma GCC poison}. The version without the
@code{GCC} prefix is deprecated. @xref{Pragmas}.
@cindex multi-line string constants
@item Multi-line string constants
Older versions of GCC allowed string constants to extend across
multiple logical lines of the source file. This ill-considered
extension has now been removed. Instead, make use of ISO C
concatenation of adjacent string literals, or use @samp{\n} followed
by a backslash-newline.
@end itemize
@node Differences from previous versions
@section Differences from previous versions
@cindex differences from previous versions
......
2002-05-09 Neil Booth <neil@daikokuya.demon.co.uk>
* gcc.dg/cpp/poison.c: Update.
* gcc.dg/cpp/20000625-2.c: Remove.
* gcc.dg/cpp/direct2s.c: Remove final test.
2002-05-08 Tom Rix <trix@redhat.com>
* gcc.c-torture/execute/20020508-1.c: New test.
......
/* More paste corner cases from glibc. */
/* { dg-do run } */
#include <stdlib.h>
#include <string.h>
#define symbol_version(name, version) name##@##version
#define str(x) xstr(x)
#define xstr(x) #x
/* This testcase is bogus, as it testing undefined behaviour. We can
get the behaviour GLIBC desires by removing the space before
GCLIB_2.0 in this line. */
const char a[] = str(symbol_version(getrlimit,GLIBC_2.0));
/* { dg-warning "valid preprocessing token" "" { target *-*-* } 14 } */
const char b[] = str(getrlimit@GLIBC_2.0);
const char c[] = "getrlimit@GLIBC_2.0";
int
main(void)
{
if(strcmp(a, b))
abort();
if(strcmp(b, c))
abort();
if(strcmp(c, a))
abort();
return 0;
}
......@@ -31,9 +31,3 @@ void f ()
int i = X; /* { dg-error "undeclared|for each" "no macro X" } */
int j = Y; /* { dg-error "undeclared|for each" "no macro Y" } */
}
#define slashstar /##*
#define starslash *##/
slashstar starslash /* { dg-error "parse error" "not a comment" } */
/* { dg-warning "does not give" "paste warning(s)" { target *-*-* } 38 } */
/* { dg-do preprocess }
{ dg-options "-fno-show-column" } */
#pragma poison foo
#pragma GCC poison foo
foo /* { dg-error "foo" "use of foo" } */
#pragma poison foo2 foo3
#pragma GCC poison foo2 foo3
foo2 /* { dg-error "foo2" "use of foo2" } */
foo3 /* { dg-error "foo3" "use of foo3" } */
#pragma poison foo4 foo5
#pragma GCC poison foo4 foo5
foo4 /* { dg-error "foo4" "use of foo4" } */
foo5 /* { dg-error "foo5" "use of foo5" } */
#pragma poison +++ /* { dg-error "invalid" "poison non-identifier" } */
#pragma GCC poison +++ /* { dg-error "invalid" "poison non-identifier" } */
#define foo6 123
#pragma poison foo6 /* { dg-warning "foo6" "poison defined macro" } */
#pragma GCC poison foo6 /* { dg-warning "foo6" "poison defined macro" } */
#define foo6 345 /* { dg-error "foo6" "def of foo6" } */
#define foo6 456 /* { dg-error "foo6" "redef of foo6" } */
#ifdef foo6 /* { dg-error "foo6" "#ifdef foo6" } */
......@@ -22,4 +22,4 @@ foo5 /* { dg-error "foo5" "use of foo5" } */
#else
foo6 /* { dg-error "foo6" "use of foo6" } */
#endif
#pragma poison
#pragma GCC poison
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment