From d5253b25191cc31eb45205f19d17fa7aad616a63 Mon Sep 17 00:00:00 2001 From: borutr Date: Sun, 28 Aug 2011 19:03:41 +0000 Subject: * support\cpp\libiberty\concat.c, support\cpp\libiberty\filenames.h, support\cpp\libiberty\hashtab.c, support\cpp\libiberty\vasprintf.c, support\cpp\libiberty\xmemdup.c, support\cpp\libiberty\hashtab.h, support\cpp\libiberty\splay-tree.c, support\cpp\libiberty\lbasename.c, support\cpp\libiberty\splay-tree.h, support\cpp\libiberty\getpwd.c, support\cpp\libiberty\fopen_unlocked.c, support\cpp\libcpp\directives.c, support\cpp\libcpp\macro.c, support\cpp\libcpp\files.c, support\cpp\libcpp\include\cpplib.h, support\cpp\libcpp\include\symtab.h, support\cpp\libcpp\include\line-map.h, support\cpp\libcpp\init.c, support\cpp\libcpp\errors.c, support\cpp\libcpp\expr.c, support\cpp\libcpp\internal.h, support\cpp\libcpp\lex.c, support\cpp\libcpp\system.h, support\cpp\libcpp\charset.c: SDCPP synchronized with GCC CPP release version 4.6.1 git-svn-id: https://svn.code.sourceforge.net/p/sdcc/code/trunk/sdcc@6773 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- support/cpp/libcpp/expr.c | 58 +++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 22 deletions(-) (limited to 'support/cpp/libcpp/expr.c') diff --git a/support/cpp/libcpp/expr.c b/support/cpp/libcpp/expr.c index 60cb2816a..3c36127b5 100644 --- a/support/cpp/libcpp/expr.c +++ b/support/cpp/libcpp/expr.c @@ -371,9 +371,9 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token) if (limit != str && CPP_WTRADITIONAL (pfile) && ! cpp_sys_macro_p (pfile)) - cpp_error (pfile, CPP_DL_WARNING, - "traditional C rejects the \"%.*s\" suffix", - (int) (limit - str), str); + cpp_warning (pfile, CPP_W_TRADITIONAL, + "traditional C rejects the \"%.*s\" suffix", + (int) (limit - str), str); /* A suffix for double is a GCC extension via decimal float support. If the suffix also specifies an imaginary value we'll catch that @@ -417,21 +417,27 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token) if (CPP_WTRADITIONAL (pfile) && ! cpp_sys_macro_p (pfile)) { int u_or_i = (result & (CPP_N_UNSIGNED|CPP_N_IMAGINARY)); - int large = (result & CPP_N_WIDTH) == CPP_N_LARGE; + int large = (result & CPP_N_WIDTH) == CPP_N_LARGE + && CPP_OPTION (pfile, cpp_warn_long_long); - if (u_or_i || (large && CPP_OPTION (pfile, warn_long_long))) - cpp_error (pfile, CPP_DL_WARNING, - "traditional C rejects the \"%.*s\" suffix", - (int) (limit - str), str); + if (u_or_i || large) + cpp_warning (pfile, large ? CPP_W_LONG_LONG : CPP_W_TRADITIONAL, + "traditional C rejects the \"%.*s\" suffix", + (int) (limit - str), str); } if ((result & CPP_N_WIDTH) == CPP_N_LARGE - && CPP_OPTION (pfile, warn_long_long)) - cpp_error (pfile, - CPP_OPTION (pfile, c99) ? CPP_DL_WARNING : CPP_DL_PEDWARN, - CPP_OPTION (pfile, cplusplus) - ? "use of C++0x long long integer constant" - : "use of C99 long long integer constant"); + && CPP_OPTION (pfile, cpp_warn_long_long)) + { + const char *message = CPP_OPTION (pfile, cplusplus) + ? N_("use of C++0x long long integer constant") + : N_("use of C99 long long integer constant"); + + if (CPP_OPTION (pfile, c99)) + cpp_warning (pfile, CPP_W_LONG_LONG, message); + else + cpp_pedwarning (pfile, CPP_W_LONG_LONG, message); + } result |= CPP_N_INTEGER; } @@ -694,6 +700,9 @@ parse_defined (cpp_reader *pfile) node->flags |= NODE_USED; if (node->type == NT_MACRO) { + if ((node->flags & NODE_BUILTIN) + && pfile->cb.user_builtin_macro) + pfile->cb.user_builtin_macro (pfile, node); if (pfile->cb.used_define) pfile->cb.used_define (pfile, pfile->directive_line, node); } @@ -711,10 +720,15 @@ parse_defined (cpp_reader *pfile) pfile->state.prevent_expansion--; + /* Do not treat conditional macros as being defined. This is due to the + powerpc and spu ports using conditional macros for 'vector', 'bool', and + 'pixel' to act as conditional keywords. This messes up tests like #ifndef + bool. */ result.unsignedp = false; result.high = 0; result.overflow = false; - result.low = node && node->type == NT_MACRO; + result.low = (node && node->type == NT_MACRO + && (node->flags & NODE_CONDITIONAL) == 0); return result; } @@ -792,8 +806,8 @@ eval_token (cpp_reader *pfile, const cpp_token *token) result.high = 0; result.low = 0; if (CPP_OPTION (pfile, warn_undef) && !pfile->state.skip_eval) - cpp_error (pfile, CPP_DL_WARNING, "\"%s\" is not defined", - NODE_NAME (token->val.node.node)); + cpp_warning (pfile, CPP_W_UNDEF, "\"%s\" is not defined", + NODE_NAME (token->val.node.node)); } break; @@ -805,9 +819,9 @@ eval_token (cpp_reader *pfile, const cpp_token *token) if (CPP_PEDANTIC (pfile)) cpp_error (pfile, CPP_DL_PEDWARN, "assertions are a GCC extension"); - else if (CPP_OPTION (pfile, warn_deprecated)) - cpp_error (pfile, CPP_DL_WARNING, - "assertions are a deprecated extension"); + else if (CPP_OPTION (pfile, cpp_warn_deprecated)) + cpp_warning (pfile, CPP_W_DEPRECATED, + "assertions are a deprecated extension"); } _cpp_test_assertion (pfile, &temp); result.high = 0; @@ -1502,8 +1516,8 @@ num_unary_op (cpp_reader *pfile, cpp_num num, enum cpp_ttype op) { case CPP_UPLUS: if (CPP_WTRADITIONAL (pfile) && !pfile->state.skip_eval) - cpp_error (pfile, CPP_DL_WARNING, - "traditional C rejects the unary plus operator"); + cpp_warning (pfile, CPP_W_TRADITIONAL, + "traditional C rejects the unary plus operator"); num.overflow = false; break; -- cgit v1.2.3