aboutsummaryrefslogtreecommitdiff
path: root/libcpp/lex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/lex.cc')
-rw-r--r--libcpp/lex.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/libcpp/lex.cc b/libcpp/lex.cc
index a429a3d..cc12a52d 100644
--- a/libcpp/lex.cc
+++ b/libcpp/lex.cc
@@ -2007,7 +2007,8 @@ name_p (cpp_reader *pfile, const cpp_string *string)
static void
warn_about_normalization (cpp_reader *pfile,
const cpp_token *token,
- const struct normalize_state *s)
+ const struct normalize_state *s,
+ bool identifier)
{
if (CPP_OPTION (pfile, warn_normalize) < NORMALIZE_STATE_RESULT (s)
&& !pfile->state.skipping)
@@ -2043,7 +2044,7 @@ warn_about_normalization (cpp_reader *pfile,
if (NORMALIZE_STATE_RESULT (s) == normalized_C)
cpp_warning_at (pfile, CPP_W_NORMALIZE, &rich_loc,
"`%.*s' is not in NFKC", (int) sz, buf);
- else if (CPP_OPTION (pfile, cplusplus))
+ else if (identifier && CPP_OPTION (pfile, xid_identifiers))
cpp_pedwarning_at (pfile, CPP_W_NORMALIZE, &rich_loc,
"`%.*s' is not in NFC", (int) sz, buf);
else
@@ -3839,7 +3840,7 @@ _cpp_lex_direct (cpp_reader *pfile)
struct normalize_state nst = INITIAL_NORMALIZE_STATE;
result->type = CPP_NUMBER;
lex_number (pfile, &result->val.str, &nst);
- warn_about_normalization (pfile, result, &nst);
+ warn_about_normalization (pfile, result, &nst, false);
break;
}
@@ -3888,7 +3889,7 @@ _cpp_lex_direct (cpp_reader *pfile)
result->val.node.node = lex_identifier (pfile, buffer->cur - 1, false,
&nst,
&result->val.node.spelling);
- warn_about_normalization (pfile, result, &nst);
+ warn_about_normalization (pfile, result, &nst, true);
}
/* Convert named operators to their proper types. */
@@ -4101,7 +4102,7 @@ _cpp_lex_direct (cpp_reader *pfile)
struct normalize_state nst = INITIAL_NORMALIZE_STATE;
result->type = CPP_NUMBER;
lex_number (pfile, &result->val.str, &nst);
- warn_about_normalization (pfile, result, &nst);
+ warn_about_normalization (pfile, result, &nst, false);
}
else if (*buffer->cur == '.' && buffer->cur[1] == '.')
buffer->cur += 2, result->type = CPP_ELLIPSIS;
@@ -4192,7 +4193,7 @@ _cpp_lex_direct (cpp_reader *pfile)
result->type = CPP_NAME;
result->val.node.node = lex_identifier (pfile, base, true, &nst,
&result->val.node.spelling);
- warn_about_normalization (pfile, result, &nst);
+ warn_about_normalization (pfile, result, &nst, true);
break;
}