[CPP PATCH] Fix warning & other cleanups.
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01162.html * directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p. * include/cpplib.h (enum cpp_macro_kind): Remove trailing comma. (cpp_fun_like_macro_p): Make inline, define. * macro.c (cpp_define_lazily): Use UCHAR_MAX. (cpp_fun_like_macro_p): Delete. From-SVN: r263666
This commit is contained in:
parent
e11b709d21
commit
7692e253ee
|
@ -1,5 +1,11 @@
|
|||
2018-08-20 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p.
|
||||
* include/cpplib.h (enum cpp_macro_kind): Remove trailing comma.
|
||||
(cpp_fun_like_macro_p): Make inline, define.
|
||||
* macro.c (cpp_define_lazily): Use UCHAR_MAX.
|
||||
(cpp_fun_like_macro_p): Delete.
|
||||
|
||||
* Makefile.in (TAGS_SOURCES): Remove cpp-id-data.h.
|
||||
* include/cpp-id-data.h: Delete.
|
||||
* internal.h: Include cpplib.h not cpp-id-data.h.
|
||||
|
|
|
@ -665,12 +665,12 @@ do_undef (cpp_reader *pfile)
|
|||
|
||||
/* 6.10.3.5 paragraph 2: [#undef] is ignored if the specified
|
||||
identifier is not currently defined as a macro name. */
|
||||
if (node->type == NT_MACRO)
|
||||
if (cpp_macro_p (node))
|
||||
{
|
||||
if (node->flags & NODE_WARN)
|
||||
cpp_error (pfile, CPP_DL_WARNING,
|
||||
"undefining \"%s\"", NODE_NAME (node));
|
||||
else if ((node->flags & NODE_BUILTIN)
|
||||
else if (cpp_builtin_macro_p (node)
|
||||
&& CPP_OPTION (pfile, warn_builtin_macro_redefined))
|
||||
cpp_warning_with_line (pfile, CPP_W_BUILTIN_MACRO_REDEFINED,
|
||||
pfile->directive_line, 0,
|
||||
|
|
|
@ -674,7 +674,7 @@ struct cpp_dir
|
|||
enum cpp_macro_kind {
|
||||
cmk_macro, /* An ISO macro (token expansion). */
|
||||
cmk_assert, /* An assertion. */
|
||||
cmk_traditional, /* A traditional macro (text expansion). */
|
||||
cmk_traditional /* A traditional macro (text expansion). */
|
||||
};
|
||||
|
||||
/* Each macro definition is recorded in a cpp_macro structure.
|
||||
|
@ -972,7 +972,10 @@ inline bool cpp_macro_p (const cpp_hashnode *node)
|
|||
return node->type == NT_MACRO;
|
||||
}
|
||||
/* Returns true if NODE is a function-like user macro. */
|
||||
extern bool cpp_fun_like_macro_p (cpp_hashnode *node);
|
||||
inline bool cpp_fun_like_macro_p (cpp_hashnode *node)
|
||||
{
|
||||
return cpp_user_macro_p (node) && node->value.macro->fun_like;
|
||||
}
|
||||
|
||||
extern const unsigned char *cpp_macro_definition (cpp_reader *,
|
||||
cpp_hashnode *);
|
||||
|
|
|
@ -3551,7 +3551,7 @@ cpp_define_lazily (cpp_reader *pfile, cpp_hashnode *node, unsigned num)
|
|||
{
|
||||
cpp_macro *macro = node->value.macro;
|
||||
|
||||
gcc_checking_assert (pfile->cb.user_lazy_macro && macro && num < 255);
|
||||
gcc_checking_assert (pfile->cb.user_lazy_macro && macro && num < UCHAR_MAX);
|
||||
|
||||
macro->lazy = num + 1;
|
||||
}
|
||||
|
@ -3632,15 +3632,6 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro,
|
|||
}
|
||||
}
|
||||
|
||||
/* Returns true of NODE is a function-like macro. */
|
||||
bool
|
||||
cpp_fun_like_macro_p (cpp_hashnode *node)
|
||||
{
|
||||
return (node->type == NT_MACRO
|
||||
&& (node->flags & (NODE_BUILTIN | NODE_MACRO_ARG)) == 0
|
||||
&& node->value.macro->fun_like);
|
||||
}
|
||||
|
||||
/* Returns the name, arguments and expansion of a macro, in a format
|
||||
suitable to be read back in again, and therefore also for DWARF 2
|
||||
debugging info. e.g. "PASTE(X, Y) X ## Y", or "MACNAME EXPANSION".
|
||||
|
|
Loading…
Reference in New Issue