public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19141] New: #pragma misbehavior with -Werror
@ 2004-12-23 16:13 ted at burghart dot org
2004-12-23 16:23 ` [Bug c++/19141] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: ted at burghart dot org @ 2004-12-23 16:13 UTC (permalink / raw)
To: gcc-bugs
Whether "#pragma once" is or is not deprecated is not the issue. Rather, the
problem is that GCC's behavior since it was deprecated is inappropriate for
writing portable code and arguably violates the intent of the C (9899-1999
6.10.6) and C++ (14882-1998 16.6) language specifications.
While the specs dictate that recognized pragma directives behave in an
implementation-defined manner, they also dicatate that unrecognized pragma
directives are ignored. It seems that GCC's behavior regarding (deprecated)
#pragma once falls in a grey area between the two, and it could be argued that
the behavior should be that of an unrecognized pragma since the directive has
no effect.
Unfortunately, the behavior of issuing a warning regarding #pragma once, with
no means to turn it off, breaks code portability while offering no benefit. If
the -Werror switch is turned on (considered good practice by many) in concert
with reasonable warning levels, legitimate portable code fails to compile
because of this behavior.
Whatever your personal feelings toward #pragma once, it is arrogant (at best)
to effectively preclude its presence in header files. Many, many compilers
recognize this pragma and (claim to) do something useful with it. If GCC
chooses not to use it, that's fine, but issuing a warning that can't be turned
off over an ineffectual, deprecated pragma directive certainly appears to
violate the spirit of the language specifications.
--
Summary: #pragma misbehavior with -Werror
Product: gcc
Version: 3.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ted at burghart dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19141
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-12-23 16:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-23 16:13 [Bug c++/19141] New: #pragma misbehavior with -Werror ted at burghart dot org
2004-12-23 16:23 ` [Bug c++/19141] " pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).