public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11569] New: there's no substitute for #pragma once
@ 2003-07-18  9:33 from-bugzilla at geek-central dot gen dot nz
  2003-07-18 13:39 ` [Bug c++/11569] " pinskia at physics dot uc dot edu
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: from-bugzilla at geek-central dot gen dot nz @ 2003-07-18  9:33 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569

           Summary: there's no substitute for #pragma once
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: from-bugzilla at geek-central dot gen dot nz
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

#pragma once used in a .h file indicates that it is only to be parsed once, 
even if it is (directly or indirectly) included multiple times in the same 
source file. However, every time you use this pragma, you get a warning 
saying it is "obsolete", and there seems to be no compiler option to turnoff 
this warning.

I believe there is some kind of recommendation that one should bracket 
the contents of the .h file with something like

#ifndef 
_SOME_ARBITRARY_SYMBOL_CONSTRUCTED_FROM_FILE_NAME_
#define 
_SOME_ARBITRARY_SYMBOL_CONSTRUCTED_FROM_FILE_NAME_

...

#endif

and gcc will "do the right thing". Now, "doing the right thing" is all very well 
where it saves you doing extra work, but where it makes you go out of your 
way to write something much more verbose than the obvious thing, as in 
this case, it just seems to me to be brain-dead.

Conclusion: please provide some way to turn off the warning about 
#pragma once being "obsolete".

Thank you.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
@ 2003-07-18 13:39 ` pinskia at physics dot uc dot edu
  2003-07-18 13:58 ` bangerth at dealii dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-18 13:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569



------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-18 13:39 -------
I think the problem is pragma once does not always work and that is why it is "obsolete".


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
  2003-07-18 13:39 ` [Bug c++/11569] " pinskia at physics dot uc dot edu
@ 2003-07-18 13:58 ` bangerth at dealii dot org
  2003-07-22  6:53 ` from-bugzilla at geek-central dot gen dot nz
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2003-07-18 13:58 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX


------- Additional Comments From bangerth at dealii dot org  2003-07-18 13:58 -------
Pragma once is obsoleted, in other words it will be removed in the next version
anyway. The warning will then become a hard error, so providing a flag now
that suppresses the warning seems pointless.

W.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
  2003-07-18 13:39 ` [Bug c++/11569] " pinskia at physics dot uc dot edu
  2003-07-18 13:58 ` bangerth at dealii dot org
@ 2003-07-22  6:53 ` from-bugzilla at geek-central dot gen dot nz
  2003-07-22 11:49 ` pinskia at physics dot uc dot edu
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: from-bugzilla at geek-central dot gen dot nz @ 2003-07-22  6:53 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569


from-bugzilla at geek-central dot gen dot nz changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|WONTFIX                     |


------- Additional Comments From from-bugzilla at geek-central dot gen dot nz  2003-07-22 06:53 -------
Wolfgang Bangerth wrote:

>Pragma once is obsoleted, in other words it will be removed in the next
>version anyway.

Why is it being removed?

Andrew Pinski wrote:

>I think the problem is pragma once does not always work and that
>is why it is "obsolete".

Under what situations might it fail to work?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
                   ` (2 preceding siblings ...)
  2003-07-22  6:53 ` from-bugzilla at geek-central dot gen dot nz
@ 2003-07-22 11:49 ` pinskia at physics dot uc dot edu
  2003-07-22 13:58 ` pinskia at physics dot uc dot edu
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-22 11:49 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569



------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-22 11:49 -------
The situations are with PCH (which is not in any released version yet).


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
                   ` (3 preceding siblings ...)
  2003-07-22 11:49 ` pinskia at physics dot uc dot edu
@ 2003-07-22 13:58 ` pinskia at physics dot uc dot edu
  2003-07-22 14:00 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-22 13:58 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-22 13:58 -------
Actually for 3.4 the switch to turn off the warning is -Wno-deprecated, so this is already 
fixed but since #pragma once is going away, I am going to close this as invalid.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
                   ` (4 preceding siblings ...)
  2003-07-22 13:58 ` pinskia at physics dot uc dot edu
@ 2003-07-22 14:00 ` bangerth at dealii dot org
  2003-07-23  4:37 ` from-bugzilla at geek-central dot gen dot nz
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2003-07-22 14:00 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569



------- Additional Comments From bangerth at dealii dot org  2003-07-22 14:00 -------
Regarding the reasons for removing the features: there have been long
discussions on the gcc mailing lists about this. I'm not familiar with
the details, but a web search on the mailing lists should turn up quite
some information.
W.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
                   ` (5 preceding siblings ...)
  2003-07-22 14:00 ` bangerth at dealii dot org
@ 2003-07-23  4:37 ` from-bugzilla at geek-central dot gen dot nz
  2003-07-23  4:54 ` from-bugzilla at geek-central dot gen dot nz
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: from-bugzilla at geek-central dot gen dot nz @ 2003-07-23  4:37 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569



------- Additional Comments From from-bugzilla at geek-central dot gen dot nz  2003-07-23 04:37 -------
Andrew Pinski wrote:

>>Under what situations might it fail to work?

>The situations are with PCH (which is not in any released version yet).

I'm not surprised PCH is not in any released version yet. You will never get 
it to work reliably, for reasons that have nothing to do with #pragma once. 
It's been tried on other platforms for many years, and it invariably ends up 
being more trouble than the problem it's trying to solve.

I speak from experience.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
                   ` (6 preceding siblings ...)
  2003-07-23  4:37 ` from-bugzilla at geek-central dot gen dot nz
@ 2003-07-23  4:54 ` from-bugzilla at geek-central dot gen dot nz
  2003-07-23 14:21 ` bangerth at dealii dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: from-bugzilla at geek-central dot gen dot nz @ 2003-07-23  4:54 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569



------- Additional Comments From from-bugzilla at geek-central dot gen dot nz  2003-07-23 04:54 -------
Wolfgang Bangerth wrote:

>Regarding the reasons for removing the features: there have been long
>discussions on the gcc mailing lists about this.

Yes, I have come across archives of such discussions. Let me 
summarize the points:

1) Possible inconsistencies in pragma semantics between different 
compilers ("pragmas are a bad idea in general").
2) Not an official standard supported by all compilers.

Well, I've got news for you. In the years since those discussions, #pragma 
once has become quite a widely supported feature, available on many 
compilers on many platforms. Essentially, it is now a de-facto standard, 
like it or not. Sure, there are technical reasons why it's a bad idea, but that 
doesn't make any difference to the fact that it is widely used. If you don't 
support it, then you put yet another obstacle in the path of those trying to 
port code from other platforms.

I can't claim that GCC isn't big enough to be a law unto itself if it wants to, 
in true Microsoft style. Do you want to be like that, or do you want to be a 
team player, mindful of the needs of those who have to cope with code 
running on multiple platforms using multiple compilers?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
                   ` (7 preceding siblings ...)
  2003-07-23  4:54 ` from-bugzilla at geek-central dot gen dot nz
@ 2003-07-23 14:21 ` bangerth at dealii dot org
  2003-07-29 22:08 ` neil at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2003-07-23 14:21 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569



------- Additional Comments From bangerth at dealii dot org  2003-07-23 14:21 -------
Your case is not helped if you insult those who have put time and thought
into the problem by accusing them of arrogant behavior. Secondly, gcc is
by and large a volunteer project. If you want to see a feature working
and supported, feel free to offer patches -- these are the rules by
which gcc works.

W.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
                   ` (8 preceding siblings ...)
  2003-07-23 14:21 ` bangerth at dealii dot org
@ 2003-07-29 22:08 ` neil at gcc dot gnu dot org
  2003-07-29 22:09 ` [Bug preprocessor/11569] " neil at gcc dot gnu dot org
  2003-07-29 22:29 ` neil at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: neil at gcc dot gnu dot org @ 2003-07-29 22:08 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569


neil at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


------- Additional Comments From neil at gcc dot gnu dot org  2003-07-29 22:08 -------
I'm handling this.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug preprocessor/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
                   ` (9 preceding siblings ...)
  2003-07-29 22:08 ` neil at gcc dot gnu dot org
@ 2003-07-29 22:09 ` neil at gcc dot gnu dot org
  2003-07-29 22:29 ` neil at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: neil at gcc dot gnu dot org @ 2003-07-29 22:09 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569


neil at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
          Component|c++                         |preprocessor
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-07-29 22:09:12
               date|                            |


------- Additional Comments From neil at gcc dot gnu dot org  2003-07-29 22:09 -------
Mine.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug preprocessor/11569] there's no substitute for #pragma once
  2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
                   ` (10 preceding siblings ...)
  2003-07-29 22:09 ` [Bug preprocessor/11569] " neil at gcc dot gnu dot org
@ 2003-07-29 22:29 ` neil at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: neil at gcc dot gnu dot org @ 2003-07-29 22:29 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11569


neil at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


------- Additional Comments From neil at gcc dot gnu dot org  2003-07-29 22:29 -------
#pragma once has been undeprecated in 3.4 because it contains a correct
implementation at last.

The problems with #pragma once have been related to filename semantics and
symlinks / hardlinks etc.

I will soon undeprecate in 3.3, though its implementation will never be fixed.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-07-29 22:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-18  9:33 [Bug c++/11569] New: there's no substitute for #pragma once from-bugzilla at geek-central dot gen dot nz
2003-07-18 13:39 ` [Bug c++/11569] " pinskia at physics dot uc dot edu
2003-07-18 13:58 ` bangerth at dealii dot org
2003-07-22  6:53 ` from-bugzilla at geek-central dot gen dot nz
2003-07-22 11:49 ` pinskia at physics dot uc dot edu
2003-07-22 13:58 ` pinskia at physics dot uc dot edu
2003-07-22 14:00 ` bangerth at dealii dot org
2003-07-23  4:37 ` from-bugzilla at geek-central dot gen dot nz
2003-07-23  4:54 ` from-bugzilla at geek-central dot gen dot nz
2003-07-23 14:21 ` bangerth at dealii dot org
2003-07-29 22:08 ` neil at gcc dot gnu dot org
2003-07-29 22:09 ` [Bug preprocessor/11569] " neil at gcc dot gnu dot org
2003-07-29 22:29 ` neil 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).