public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to see macros active in error messages
@ 2020-11-23 12:24 emre brookes
  2020-11-23 15:41 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: emre brookes @ 2020-11-23 12:24 UTC (permalink / raw)
  To: gcc-help

I was compiling a project and received an odd message that took some 
digging.
e.g.

file.cpp:#:#: error: expected unqualified-id before numeric constant
# | if ( inttype == MyClass::ERROR )
                              ^~~~~
where MyClass::ERROR is an enum.

Took some digging to find out ERROR was somewhere #define'd and the cure 
was to #undef ERROR
Could never find out *where* it was defined - recursively searched all 
include files of the project and /usr/include etc.
Regardless, it would have been very helpful to know in the error 
messages that a #define was active or to have the ERROR replaced by the 
macro substitution.

Is it possible to get any macro expansion information in error messages?
I didn't see a compiler flag for to get this information, but I might 
have missed it.
If not, it would be a nice feature to have.

Cheers,
Emre.


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

* Re: How to see macros active in error messages
  2020-11-23 12:24 How to see macros active in error messages emre brookes
@ 2020-11-23 15:41 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2020-11-23 15:41 UTC (permalink / raw)
  To: emre brookes; +Cc: gcc-help

On Mon, 23 Nov 2020 at 12:25, emre brookes wrote:
>
> I was compiling a project and received an odd message that took some
> digging.

Didn't you already send this yesterday?


> e.g.
>
> file.cpp:#:#: error: expected unqualified-id before numeric constant
> # | if ( inttype == MyClass::ERROR )
>                               ^~~~~
> where MyClass::ERROR is an enum.
>
> Took some digging to find out ERROR was somewhere #define'd and the cure
> was to #undef ERROR
> Could never find out *where* it was defined - recursively searched all
> include files of the project and /usr/include etc.
> Regardless, it would have been very helpful to know in the error
> messages that a #define was active or to have the ERROR replaced by the
> macro substitution.
>
> Is it possible to get any macro expansion information in error messages?
> I didn't see a compiler flag for to get this information, but I might
> have missed it.
> If not, it would be a nice feature to have.
>
> Cheers,
> Emre.
>

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

end of thread, other threads:[~2020-11-23 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 12:24 How to see macros active in error messages emre brookes
2020-11-23 15:41 ` Jonathan Wakely

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