https://gcc.gnu.org/g:40ecb065cebd9537e7de0f77e677707fbeb962dd
commit r16-8378-g40ecb065cebd9537e7de0f77e677707fbeb962dd Author: Sandra Loosemore <[email protected]> Date: Wed Apr 1 04:59:45 2026 +0000 doc: Fix wrong documentation for -finput-charset [PR61896] This patch fixes long-standing bugs in the documentation for -finput-charset. Support for getting the default charset from the locale has been disabled since 2004. The error behavior has never been documented, and now there is -Winvalid-utf8 that should be mentioned in this context too. gcc/ChangeLog PR c/61896 * doc/cppopts.texi (-finput-charset=): Remove long-obsolete locale discussion. Document behavior about ill-formed inputs. Diff: --- gcc/doc/cppopts.texi | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi index e5ac751292bf..94490775509f 100644 --- a/gcc/doc/cppopts.texi +++ b/gcc/doc/cppopts.texi @@ -372,13 +372,17 @@ problems with encodings that do not fit exactly in @code{wchar_t}. @cindex character set, input @item -finput-charset=@var{charset} Set the input character set, used for translation from the character -set of the input file to the source character set used by GCC@. If the -locale does not specify, or GCC cannot get this information from the -locale, the default is UTF-8. This can be overridden by either the locale -or this command-line option. Currently the command-line option takes -precedence if there's a conflict. @var{charset} can be any encoding +set of the input file to the source character set used by GCC@. The +default is UTF-8. @var{charset} can be any encoding supported by the system's @code{iconv} library routine. +If the input character set is UTF-8, warnings about ill-formed code +unit sequences are issued if @option{-Winvalid-utf8} is enabled. +Otherwise no diagnostics are issued when the input character set +matches the execution character set. If they are different, +ill-formed code unit sequences result in an error during transcoding +to the execution character set. + @ifclear cppmanual @opindex fpch-deps @opindex fno-pch-deps
