preprocessor/10613: Please make -Wtrigraphs the default

Hallvard B Furuseth h.b.furuseth@usit.uio.no
Sat May 3 23:36:00 GMT 2003


>Number:         10613
>Category:       preprocessor
>Synopsis:       Please make -Wtrigraphs the default
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sat May 03 23:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Hallvard B Furuseth
>Release:        3.2.3
>Organization:
University of Oslo
>Environment:
System: SunOS bombur.uio.no 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../gcc-3.2.3/configure --enable-languages=c,c++,f77 --disable-shared --disable-multilib --prefix=/usit/bombur/hbf --enable-version-specific-runtime-libs --enable-threads
>Description:
	Gcc *silently* compiles code like `puts("??!")' incorrectly: It
	prints `??!' instead of `|'.  I agree that not converting
	trigraphs is the best default, they are most likely programmer
	errors.  However, fixing a programmer error without telling the
	programmer is very bad, we'll test our code and think it's
	correct when it will misbehave with other (correct) compilers.
>How-To-Repeat:
	int main() { puts("??!"); return 0; }
>Fix:
	Turn on -Wtrigraphs by default, maybe except if -trigraphs is
	given.  (I suggest to do so even if -ansi is given, since they
	are still probably programmer bugs, but that's less important.)

	BTW, I suggest moving the detailed description of trigraphs from
	Info node (gcc)Preprocessor Options to (gcc)C Dialect Options or
	to a separate node.  They may technically fit better where they
	are now, but people are more likely to look at the latter nodes.
	And you might add that the fix for unintended trigraphs in string
	literals is to split them up from "??!" to "?" "?!".
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list