aboutsummaryrefslogtreecommitdiff
path: root/libcpp/include/cpplib.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/include/cpplib.h')
-rw-r--r--libcpp/include/cpplib.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 75efdcd..bbd88e5 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -620,6 +620,9 @@ struct cpp_options
/* True if -finput-charset= option has been used explicitly. */
bool cpp_input_charset_explicit;
+ /* True if -Wkeyword-macro. */
+ bool cpp_warn_keyword_macro;
+
/* -Wleading-whitespace= value. */
unsigned char cpp_warn_leading_whitespace;
@@ -757,7 +760,8 @@ enum cpp_warning_reason {
CPP_W_HEADER_GUARD,
CPP_W_PRAGMA_ONCE_OUTSIDE_HEADER,
CPP_W_LEADING_WHITESPACE,
- CPP_W_TRAILING_WHITESPACE
+ CPP_W_TRAILING_WHITESPACE,
+ CPP_W_KEYWORD_MACRO
};
/* Callback for header lookup for HEADER, which is the name of a
@@ -1250,6 +1254,17 @@ inline bool cpp_fun_like_macro_p (cpp_hashnode *node)
return cpp_user_macro_p (node) && node->value.macro->fun_like;
}
+/* Return true for nodes marked for -Wkeyword-macro diagnostics. */
+inline bool cpp_keyword_p (cpp_hashnode *node)
+{
+ /* As keywords are marked identifiers which don't start with underscore
+ or start with underscore followed by capital letter (except for
+ _Pragma). */
+ return ((node->flags & NODE_WARN)
+ && (NODE_NAME (node)[0] != '_'
+ || (NODE_NAME (node)[1] != '_' && NODE_NAME (node)[1] != 'P')));
+}
+
extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *);
extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *,
const cpp_macro *);