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.
/* 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,
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.
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 *);
{
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;
}
}
}
-/* 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".