public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Pedantic mode and standard headers
@ 2023-08-30  0:21 Andy
  2023-08-30  8:43 ` Xi Ruoyao
  0 siblings, 1 reply; 2+ messages in thread
From: Andy @ 2023-08-30  0:21 UTC (permalink / raw)
  To: gcc-help

C90 mode allows GNU extensions, I I care about clean C90 because I try
to write C90 ANTLR grammar. Pedantic mode helps.
Standard header uses GNU extensions (?) and if I preprocess file, it wii:
- pedantic mode change preprocessed file and no GNU extension in this file
- in the preprocessed file will GNU extensions.
I have questions: if in a preprocessed file will GNU extensions. it
compile with Pedantic mode? Or pedantic will be used only on
preprocessed part main .cpp file, for preprocessed  standard headers
file it uses GNU extensions?

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

* Re: Pedantic mode and standard headers
  2023-08-30  0:21 Pedantic mode and standard headers Andy
@ 2023-08-30  8:43 ` Xi Ruoyao
  0 siblings, 0 replies; 2+ messages in thread
From: Xi Ruoyao @ 2023-08-30  8:43 UTC (permalink / raw)
  To: Andy; +Cc: gcc-help

On Wed, 2023-08-30 at 02:21 +0200, Andy via Gcc-help wrote:
> C90 mode allows GNU extensions, I I care about clean C90 because I try
> to write C90 ANTLR grammar. Pedantic mode helps.
> Standard header uses GNU extensions (?) and if I preprocess file, it
> wii:
> - pedantic mode change preprocessed file and no GNU extension in this
> file

No.

> - in the preprocessed file will GNU extensions.

Yes.

> I have questions: if in a preprocessed file will GNU extensions. it
> compile with Pedantic mode?

It depends on what a "preprocessed file" is.

Normally the preprocessed file outputted by GCC contains linemarkers
like

# 1 "/usr/include/stdio.h" 1 3 4

here "3" means the following text comes from a system header file, so
pedantic warnings are disabled.

But if the preprocessed file is generated with "gcc -E -P", then
linermarkers are removed by "-P" so the pedantic warnings will alarm.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

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

end of thread, other threads:[~2023-08-30  8:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30  0:21 Pedantic mode and standard headers Andy
2023-08-30  8:43 ` Xi Ruoyao

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