On Wed, 28 Aug 2024, Jason Merrill wrote:
> Tested x86_64-pc-linux-gnu. Any objections? Should I change all the other
> instances of
>
> if (CPP_PEDANTIC...
> cpp_error (...CPP_DL_PEDWARN
>
> the same way?
Yes, I think that's a good change.
A followup question might be whether cases such as the unchanged code in
> - if (!CPP_OPTION (pfile, binary_constants)
> - && CPP_PEDANTIC (pfile))
> - cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0,
> - CPP_OPTION (pfile, cplusplus)
> - ? N_("binary constants are a C++14 feature "
> - "or GCC extension")
> - : N_("binary constants are a C23 feature "
> - "or GCC extension"));
> + if (!CPP_OPTION (pfile, binary_constants))
> + cpp_pedwarning_with_line (pfile, CPP_W_PEDANTIC, virtual_location, 0,
> + CPP_OPTION (pfile, cplusplus)
> + ? N_("binary constants are a C++14 feature "
> + "or GCC extension")
> + : N_("binary constants are a C23 feature "
> + "or GCC extension"));
> else if (CPP_OPTION (pfile, cpp_warn_c11_c23_compat) > 0)
> cpp_warning_with_line (pfile, CPP_W_C11_C23_COMPAT,
> virtual_location, 0,
could be refactored to reduce duplication (the C front end has pedwarn_c11
for such cases of features added in C23, that can be a pedwarn-if-pedantic
up to C11, or a warning with -Wc11-c23-compat). Though libcpp handling
both C and C++, and the use of conditionals such as CPP_OPTION (pfile,
binary_constants) for individual features, might make that hard.
--
Joseph S. Myers
[email protected]