From: Sandra Loosemore Date: Wed, 1 Apr 2026 04:59:45 +0000 (+0000) Subject: doc: Fix wrong documentation for -finput-charset [PR61896] X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=40ecb065cebd9537e7de0f77e677707fbeb962dd;p=thirdparty%2Fgcc.git 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 --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi index e5ac751292b..94490775509 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