public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: michael@moria.de
To: gcc-gnats@gcc.gnu.org
Subject: preprocessor/9203: preprocessor
Date: Mon, 06 Jan 2003 22:36:00 -0000	[thread overview]
Message-ID: <20030106222603.459.qmail@palantir.moria.de> (raw)


>Number:         9203
>Category:       preprocessor
>Synopsis:       preprocessor
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 06 14:36:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Michael Haardt
>Release:        3.2
>Organization:
>Environment:
System: Linux palantir 2.4.20-rc1 #8 Wed Nov 6 23:26:07 CET 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.2/configure --prefix=/usr
>Description:

The preprocessor allows to compare numbers with identifiers.  I am not
sure if it's a bug or required by the standard, but even if it is legal,
a warning just would have saved me some time.  According to the ANSI C
grammar (K&R, 2nd edition), the syntax allows the comparison.  I can't
find a reference concerning semantics.
	
>How-To-Repeat:

michael@elrond; cat a.c
#if 123<ABC
number less than identifier
#else
number greater than identifier
#endif
michael@elrond; gcc -E -Wall -ansi -pedantic a.c
# 1 "a.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "a.c"



number greater than identifier


>Fix:

Even if it is legal, which I doubt but can not tell, -Wall should
issue a warning.  Otherwise of course an error would be nice.

The above happened in a comparison of #define constants, of which
one was spelled wrong, so it was not substituted.  That can easily
happen and I would appreciate gcc telling me so.

Michael
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-01-06 22:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-06 22:36 michael [this message]
2003-01-06 23:12 neil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030106222603.459.qmail@palantir.moria.de \
    --to=michael@moria.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).