summaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-07 22:24:34 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-07 22:24:34 +0000
commit1fcd08b185406bf47bb33b56a0ed3d343144f5d9 (patch)
treea9b9cd034b9b3c1cc173cb5e609c95a9d4411d72 /gcc/c-lex.c
parentfa88dd2b056ac00a80273ea1076961c862067420 (diff)
downloadgcc-1fcd08b185406bf47bb33b56a0ed3d343144f5d9.tar.gz
* c-pragma.h: Define HANDLE_GENERIC_PRAGMAS if
REGISTER_TARGET_PRAGMAS is defined. Duplicate some definitions from cpplib.h. * cpplib.h: Don't typedef struct cpp_reader if c-pragma.h has already done it. * tm.texi: Document HANDLE_PRAGMA as no longer supported. Add documentation for REGISTER_TARGET_PRAGMAS. * c-lex.c: Include cpplib.h before c-pragma.h. Define a default-pragma callback to implement -Wunknown-pragmas if USE_CPPLIB. * c-parse.in: Move all includes to top of file. * c-pragma.c: Include cpplib.h before c-pragma.h. Include tm_p.h. (dispatch_pragma): Put the namespace in the -Wunknown-pragmas warning. (init_pragma): If REGISTER_TARGET_PRAGMAS is defined, call it. * arm.h, arm-protos.h, arm.c, c4x.h, c4x-protos.h, c4x.c, h8300.h, h8300-protos.h, h8300.c, i370.h, i370-protos.h, i370.c, i960.h, i960-protos.h, i960.c, sh.h, sh-protos.h, sh.c, v850.h, v850-protos.h, v850.c: Convert HANDLE_PRAGMA-based pragmata scheme to use REGISTER_TARGET_PRAGMAS instead. * d30v.h: Don't mention HANDLE_PRAGMA in comment. Add multiple include guard. * i370.md (untyped_call): Use GEN_CALL. (umodsi3): Remove unused variable. * sh/elf.h: Don't undef HANDLE_SYSV_PRAGMA. * v850.c (output_move_single, output_move_double): Constify return value. (print_operand): Constify a char *. * v850.h (struct small_memory_info): Constify name member. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36249 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 84ef09499bc..63ae9ba6676 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -30,6 +30,7 @@ Boston, MA 02111-1307, USA. */
#include "c-tree.h"
#include "flags.h"
#include "timevar.h"
+#include "cpplib.h"
#include "c-pragma.h"
#include "toplev.h"
#include "intl.h"
@@ -52,8 +53,6 @@ Boston, MA 02111-1307, USA. */
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ((ENV_VALUE) = getenv (ENV_NAME))
#endif
-#include "cpplib.h"
-
#if USE_CPPLIB
extern cpp_reader parse_in;
#else
@@ -162,6 +161,7 @@ static void cb_ident PARAMS ((cpp_reader *, const unsigned char *,
static void cb_enter_file PARAMS ((cpp_reader *));
static void cb_leave_file PARAMS ((cpp_reader *));
static void cb_rename_file PARAMS ((cpp_reader *));
+static void cb_def_pragma PARAMS ((cpp_reader *));
#endif
@@ -210,6 +210,7 @@ init_c_lex (filename)
parse_in.cb.enter_file = cb_enter_file;
parse_in.cb.leave_file = cb_leave_file;
parse_in.cb.rename_file = cb_rename_file;
+ parse_in.cb.def_pragma = cb_def_pragma;
/* Make sure parse_in.digraphs matches flag_digraphs. */
CPP_OPTION (&parse_in, digraphs) = flag_digraphs;
@@ -777,6 +778,27 @@ cb_rename_file (pfile)
/* Hook for C++. */
extract_interface_info ();
}
+
+static void
+cb_def_pragma (pfile)
+ cpp_reader *pfile;
+{
+ /* Issue a warning message if we have been asked to do so. Ignore
+ unknown pragmas in system headers unless an explicit
+ -Wunknown-pragmas has been given. */
+ if (warn_unknown_pragmas > in_system_header)
+ {
+ const unsigned char *space, *name;
+ const cpp_token *t = pfile->first_directive_token + 2;
+
+ space = t[0].val.node->name;
+ name = t[1].type == CPP_NAME ? t[1].val.node->name : 0;
+ if (name)
+ warning ("ignoring #pragma %s %s", space, name);
+ else
+ warning ("ignoring #pragma %s", space);
+ }
+}
#endif /* USE_CPPLIB */
/* Parse a '\uNNNN' or '\UNNNNNNNN' sequence.