public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113873] New: false warning about #pragma once
@ 2024-02-11  9:45 jadexradex at gmail dot com
  2024-02-11  9:54 ` [Bug c++/113873] " sjames at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jadexradex at gmail dot com @ 2024-02-11  9:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113873

            Bug ID: 113873
           Summary: false warning about #pragma once
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jadexradex at gmail dot com
  Target Milestone: ---

If you create an empty file with C/C++ extension and write "#pragma once", it
will show warning "#pragma once in main file".

However, this file does not have any code or entry point. So this message may
be misleading.

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

* [Bug c++/113873] false warning about #pragma once
  2024-02-11  9:45 [Bug c++/113873] New: false warning about #pragma once jadexradex at gmail dot com
@ 2024-02-11  9:54 ` sjames at gcc dot gnu.org
  2024-02-11 10:28 ` [Bug preprocessor/113873] " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-02-11  9:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113873

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sjames at gcc dot gnu.org

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Jadex Radex from comment #0)
> If you create an empty file with C/C++ extension and write "#pragma once",
> it will show warning "#pragma once in main file".
> 

What is "it" here? Is it "g++ foo.cxx', or is it 'g++ -c foo.cxx', or something
else?

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

* [Bug preprocessor/113873] false warning about #pragma once
  2024-02-11  9:45 [Bug c++/113873] New: false warning about #pragma once jadexradex at gmail dot com
  2024-02-11  9:54 ` [Bug c++/113873] " sjames at gcc dot gnu.org
@ 2024-02-11 10:28 ` pinskia at gcc dot gnu.org
  2024-02-11 10:28 ` pinskia at gcc dot gnu.org
  2024-02-11 10:32 ` jadexradex at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-11 10:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113873

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
          Component|c++                         |preprocessor

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you provide an exact commands you used to compile?
Main here is pointing to the main source file that is being compiled.
Maybe the warning could be slightly clearer but it is basically saying you
can't use it outside of a header file that is being `#include`d.

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

* [Bug preprocessor/113873] false warning about #pragma once
  2024-02-11  9:45 [Bug c++/113873] New: false warning about #pragma once jadexradex at gmail dot com
  2024-02-11  9:54 ` [Bug c++/113873] " sjames at gcc dot gnu.org
  2024-02-11 10:28 ` [Bug preprocessor/113873] " pinskia at gcc dot gnu.org
@ 2024-02-11 10:28 ` pinskia at gcc dot gnu.org
  2024-02-11 10:32 ` jadexradex at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-11 10:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113873

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh it is basically a dup of bug 89808.

*** This bug has been marked as a duplicate of bug 89808 ***

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

* [Bug preprocessor/113873] false warning about #pragma once
  2024-02-11  9:45 [Bug c++/113873] New: false warning about #pragma once jadexradex at gmail dot com
                   ` (2 preceding siblings ...)
  2024-02-11 10:28 ` pinskia at gcc dot gnu.org
@ 2024-02-11 10:32 ` jadexradex at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jadexradex at gmail dot com @ 2024-02-11 10:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113873

--- Comment #4 from Jadex Radex <jadexradex at gmail dot com> ---
(In reply to Sam James from comment #1)
> (In reply to Jadex Radex from comment #0)
> > If you create an empty file with C/C++ extension and write "#pragma once",
> > it will show warning "#pragma once in main file".
> > 
> 
> What is "it" here? Is it "g++ foo.cxx', or is it 'g++ -c foo.cxx', or
> something else?

Sorry for my ambiguous explanation. I meant the warning inside a code editor
(micro in my case). It doesn't appears at compilation stage.

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

end of thread, other threads:[~2024-02-11 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-11  9:45 [Bug c++/113873] New: false warning about #pragma once jadexradex at gmail dot com
2024-02-11  9:54 ` [Bug c++/113873] " sjames at gcc dot gnu.org
2024-02-11 10:28 ` [Bug preprocessor/113873] " pinskia at gcc dot gnu.org
2024-02-11 10:28 ` pinskia at gcc dot gnu.org
2024-02-11 10:32 ` jadexradex at gmail dot com

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).