From 8b97c5f8ef218afce7499abe8cd3e6eb1f729306 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Thu, 7 Sep 2000 22:24:34 +0000 Subject: c-pragma.h: Define HANDLE_GENERIC_PRAGMAS if REGISTER_TARGET_PRAGMAS is defined. * 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. From-SVN: r36249 --- gcc/c-lex.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'gcc/c-lex.c') diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 84ef094..63ae9ba 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. -- cgit v1.1