2018-08-08 Nathan Sidwell <nathan@acm.org>
+ gcc/c-family/
+ c-ppoutput.c (dump_macro): No need to check for assert here.
+ libcpp/
+ * include/cpplib.h (cpp_user_macro_p): Check non-assertness here.
+ (cpp_fun_like_macro_p): Make inline.
+ * macro.c (enter_macro_context): Use it directly.
+ (cpp_fun_like_macro_p): Remove definition here.
+ * pch.c (save_macros): Not need to check assertness here.
+
Merge trunk r263434.
Fold cpp-id-data.h into cpplib.h
#include "system.h"
#include "coretypes.h"
#include "c-common.h" /* For flags. */
-#include "../libcpp/internal.h"
+#include "../libcpp/internal.h" /* EW! */
#include "c-pragma.h" /* For parse_in. */
#include "file-prefix-map.h" /* remap_macro_filename() */
dump_macro (cpp_reader *pfile, cpp_hashnode *node, void *v ATTRIBUTE_UNUSED)
{
/* asserts are distinguished by beginning with '#'. */
- if (cpp_user_macro_p (node) && NODE_NAME(node)[0] != '#')
+ if (cpp_user_macro_p (node))
{
fputs ("#define ", print.outf);
fputs ((const char *) cpp_macro_definition (pfile, node),
extern const cpp_token *cpp_get_token (cpp_reader *);
extern const cpp_token *cpp_get_token_with_location (cpp_reader *,
source_location *);
-/* Although a macro may actually turn out to be an assert, they are
- separated by namespace, in that the latter have special
- '#'-starting names, that macros cannot have. We don't have to
- check that. */
inline bool cpp_user_macro_p (const cpp_hashnode *node)
{
- return node->type == NT_USER_MACRO;
+ return node->type == NT_USER_MACRO && node->value.macro->kind != cmk_assert;
}
inline bool cpp_builtin_macro_p (const cpp_hashnode *node)
{
return node->type == NT_BUILTIN_MACRO;
}
+/* Although a macro may actually turn out to be an assert, they are
+ separated by namespace, in that the latter have special
+ '#'-starting names, that macros cannot have. We don't have to
+ check that here. */
inline bool cpp_macro_p (const cpp_hashnode *node)
{
return node->type & NT_USER_MACRO;
}
-extern bool cpp_fun_like_macro_p (cpp_hashnode *);
+/* Returns true if NODE is a function-like user macro. */
+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 *);
extern source_location cpp_macro_definition_location (cpp_hashnode *);
source_location expand_loc;
if (/* The top-level macro invocation that triggered the expansion
- we are looking at is with a standard macro ... */
- cpp_user_macro_p (pfile->top_most_macro_node)
- /* ... and it's a function-like macro invocation, */
- && pfile->top_most_macro_node->value.macro->fun_like
+ we are looking at is with a function-like user macro ... */
+ cpp_fun_like_macro_p (pfile->top_most_macro_node)
/* ... and we are tracking the macro expansion. */
&& CPP_OPTION (pfile, track_macro_expansion))
/* Then the location of the end of the macro invocation is the
}
}
-/* Returns true if NODE is a function-like macro. */
-bool
-cpp_fun_like_macro_p (cpp_hashnode *node)
-{
- return cpp_user_macro_p (node) && 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".
{
struct save_macro_data *data = (struct save_macro_data *)data_p;
- if (cpp_user_macro_p (h) && h->value.macro->kind != cmk_assert)
+ if (cpp_user_macro_p (h))
{
if (data->count == data->array_size)
{