public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/57665] New: cpp: stringification does not work for __GNUC__
@ 2013-06-21  7:53 Ulrich.Windl at rz dot uni-regensburg.de
  2013-06-21  8:21 ` [Bug c/57665] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich.Windl at rz dot uni-regensburg.de @ 2013-06-21  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57665
           Summary: cpp: stringification does not work for __GNUC__
           Product: gcc
           Version: 4.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Ulrich.Windl at rz dot uni-regensburg.de

It seems stringification for "__GNUC__" and other related numbers does not
work:
Using "#__GNUC__" produces "# 4" as output, not the expected ``"4"''.
I tried something like
#define GCC_VERSION #__GNUC__ "." #___GNUC_MINOR__ "." #__GNUC_PATCHLEVEL
but all I get is "stray `#' in program"


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

* [Bug c/57665] cpp: stringification does not work for __GNUC__
  2013-06-21  7:53 [Bug c/57665] New: cpp: stringification does not work for __GNUC__ Ulrich.Windl at rz dot uni-regensburg.de
@ 2013-06-21  8:21 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2013-06-21  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
1) You didn't attach a testcase

2) GCC 4.3 is unsupported and unmaintained

3) You have the wrong number of underscores: 
#define GCC_VERSION #__GNUC__ "." #___GNUC_MINOR__ "." #__GNUC_PATCHLEVEL
                                   ^^^                                   ^^

4) why are you expecting __GNUC__ to behave differently to this?
#define GNUC 4
#define GNUC_MINOR 3
#define GNUC_PATCHLEVEL 4
#define GCC_VERSION #GNUC "." #GNUC_MINOR "." #GNUC_PATCHLEVEL
const char* ver = GCC_VERSION;

That's not how the preprocessor works.


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

end of thread, other threads:[~2013-06-21  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-21  7:53 [Bug c/57665] New: cpp: stringification does not work for __GNUC__ Ulrich.Windl at rz dot uni-regensburg.de
2013-06-21  8:21 ` [Bug c/57665] " 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).