From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18042 invoked by alias); 23 Dec 2004 16:13:40 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 17703 invoked by uid 48); 23 Dec 2004 16:13:33 -0000 Date: Thu, 23 Dec 2004 16:13:00 -0000 From: "ted at burghart dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20041223161330.19141.ted@burghart.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/19141] New: #pragma misbehavior with -Werror X-Bugzilla-Reason: CC X-SW-Source: 2004-12/txt/msg03354.txt.bz2 List-Id: 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