public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/48865] New: It would be useful to have a way to check the value of a #define at preprocessing time
@ 2011-05-04  9:02 bero at arklinux dot org
  2011-05-04  9:31 ` [Bug preprocessor/48865] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bero at arklinux dot org @ 2011-05-04  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: It would be useful to have a way to check the value of
                    a #define at preprocessing time
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bero@arklinux.org


When debugging compile failures in huge projects that heavily (ab)use
preprocessor macros, it would be useful to have a way to output the value of a
preprocessor token, e.g. something like

#define XYZ 42 // buried deep inside some header
#warning XYZ is ##XYZ

should say
XYZ is 42

or, better yet:
XYZ is 42 (defined in something.h:123, included from somethingelse.h:456,
included from stillsomethingelse.h:789)


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

* [Bug preprocessor/48865] It would be useful to have a way to check the value of a #define at preprocessing time
  2011-05-04  9:02 [Bug preprocessor/48865] New: It would be useful to have a way to check the value of a #define at preprocessing time bero at arklinux dot org
@ 2011-05-04  9:31 ` jakub at gcc dot gnu.org
  2011-05-04 11:16 ` bero at arklinux dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-04  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-04 09:29:48 UTC ---
gcc -E -dD doesn't help?


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

* [Bug preprocessor/48865] It would be useful to have a way to check the value of a #define at preprocessing time
  2011-05-04  9:02 [Bug preprocessor/48865] New: It would be useful to have a way to check the value of a #define at preprocessing time bero at arklinux dot org
  2011-05-04  9:31 ` [Bug preprocessor/48865] " jakub at gcc dot gnu.org
@ 2011-05-04 11:16 ` bero at arklinux dot org
  2011-05-04 12:18 ` redi at gcc dot gnu.org
  2011-05-04 17:13 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: bero at arklinux dot org @ 2011-05-04 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from bero at arklinux dot org 2011-05-04 11:16:01 UTC ---
It does - if you know how to read it.

It's easy to tell a student who has never used a compiler outside of an IDE how
to add a #warning -- teaching him how to read the output of -E -dD is quite a
bit harder and might trigger the old "Linux is hard, give me my Vi$ual $tudio"
myth.

Even for someone who does know how to read -E -dD, I think sometimes the "easy"
way could be quicker sometimes (especially locating the relevant place in
pieces of code that are so full of macros that the output doesn't bear much
resemblance to the original).


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

* [Bug preprocessor/48865] It would be useful to have a way to check the value of a #define at preprocessing time
  2011-05-04  9:02 [Bug preprocessor/48865] New: It would be useful to have a way to check the value of a #define at preprocessing time bero at arklinux dot org
  2011-05-04  9:31 ` [Bug preprocessor/48865] " jakub at gcc dot gnu.org
  2011-05-04 11:16 ` bero at arklinux dot org
@ 2011-05-04 12:18 ` redi at gcc dot gnu.org
  2011-05-04 17:13 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-04 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-04 12:11:04 UTC ---
Teach them to how to pipe the output of gcc -E -dD to grep, it'll do them good
in the long run.


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

* [Bug preprocessor/48865] It would be useful to have a way to check the value of a #define at preprocessing time
  2011-05-04  9:02 [Bug preprocessor/48865] New: It would be useful to have a way to check the value of a #define at preprocessing time bero at arklinux dot org
                   ` (2 preceding siblings ...)
  2011-05-04 12:18 ` redi at gcc dot gnu.org
@ 2011-05-04 17:13 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-04 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-04 17:10:49 UTC ---
Or, as I've just done, learn how to do it in your favourite editor. For mine
(vim) it's [i to display the value and [^i to jump to the definition, which
seems at least as good as the IDE you mention, and much quicker than changing
the code and compiling it.


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

end of thread, other threads:[~2011-05-04 17:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04  9:02 [Bug preprocessor/48865] New: It would be useful to have a way to check the value of a #define at preprocessing time bero at arklinux dot org
2011-05-04  9:31 ` [Bug preprocessor/48865] " jakub at gcc dot gnu.org
2011-05-04 11:16 ` bero at arklinux dot org
2011-05-04 12:18 ` redi at gcc dot gnu.org
2011-05-04 17:13 ` redi at gcc dot gnu.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).