aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constexpr.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2020-05-22 01:10:50 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:10:04 -0300
commit1a85838d60472a6ec459ebb78b13d1036a04ec02 (patch)
treecae83ece2072dcf4c7b60e85d7dfad2fabef3c96 /gcc/cp/constexpr.c
parentc6cd10aaa60a07427ee0cf4e1224894b29fe394c (diff)
downloadgcc-1a85838d60472a6ec459ebb78b13d1036a04ec02.zip
gcc-1a85838d60472a6ec459ebb78b13d1036a04ec02.tar.gz
gcc-1a85838d60472a6ec459ebb78b13d1036a04ec02.tar.bz2
Provide diagnostic hints for missing C inttypes.h string constants.
This adds a flag to c_parser so we know when we were trying to construct a string literal. If there is a parse error and we were constructing a string literal, and the next token is an unknown identifier name, and we know there is a standard header that defines that name as a string literal, then add a missing header hint to the error messsage. The list of macro names are also used when providing a hint for missing identifiers. gcc/c-family/ChangeLog: * known-headers.cc (get_string_macro_hint): New function. (get_stdlib_header_for_name): Use get_string_macro_hint. (get_c_stdlib_header_for_string_macro_name): New function. * known-headers.h (get_c_stdlib_header_for_string_macro_name): New function declaration. gcc/c/ChangeLog: * c-parser.c (struct c_parser): Add seen_string_literal bitfield. (c_parser_consume_token): Reset seen_string_literal. (c_parser_error_richloc): Add name_hint if seen_string_literal and next token is a CPP_NAME and we have a missing header suggestion for the name. (c_parser_string_literal): Set seen_string_literal. gcc/testsuite/ChangeLog: * gcc.dg/spellcheck-inttypes.c: New test. * g++.dg/spellcheck-inttypes.C: Likewise.
Diffstat (limited to 'gcc/cp/constexpr.c')
0 files changed, 0 insertions, 0 deletions