Martin Michlmayr wrote:
...
- The "no newline" and "xxx redfined" pedwarnings should be converted
  into normal warnings.  Rationale: no newline doesn't harm anyone and
  there are quite a few programs that would fail because of an error
  that many agree is too strict.  Redefining something with -D seems
  like an useful feature and again quite a few applications do this.
I regret to say that the "xxx redefined" diagnostic *is* mandatory per
C99 - 6.10.3p2:

# Constraints
# ...
#  An identifier currently defined as an object-like macro shall not be
redefined by another
#  #define preprocessing directive unless the second definition is an
object-like macro
#  definition and the two replacement lists are identical. Likewise, an
identifier currently
#  defined as a function-like macro shall not be redefined by another #define
#  preprocessing directive unless the second definition is a
function-like macro definition
#  that has the same number and spelling of parameters, and the two
replacement lists are
#  identical.

This therefore needs to stay a pedwarn at least for the case where the
redefinition comes from a #define in the source.  It's not clear to me
whether the diagnostics you're talking about are from a redefinition
via -D on the command line.  I would be okay with suppressing the
diagnostic altogether when there are two -D's on the command line --
the standard has nothing to say about command line behavior, and we
generally make the later of two conflicting switches win.  The right
place to implement that would be warn_of_redefinition.

[ Paging the Steering Committee: we need an actual cpplib maintainer. ]

zw

Reply via email to