llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.71k stars 11.87k forks source link

Add pedantic checking for constant expressions to clang #4774

Open efriedma-quic opened 15 years ago

efriedma-quic commented 15 years ago
Bugzilla Link 4402
Version unspecified
OS Linux
CC @hvdijk

Extended Description

From Sema::CheckForConstantInitializer:

  // FIXME: Need strict checking.  In C89, we need to check for
  // any assignment, increment, decrement, function-calls, or
  // commas outside of a sizeof.  In C99, it's the same list,
  // except that the aforementioned are allowed in unevaluated
  // expressions.  Everything else falls under the
  // "may accept other forms of constant expressions" exception.
  // (We never end up here for C++, so the constant expression
  // rules there don't matter.)

Filing here for completeness. This is relatively low-priority because it's a non-trivial amount of work, and it's a warning nobody would care about outside of -pedantic mode.

ec04fc15-fa35-46f2-80e1-5d271f2ef708 commented 2 years ago

mentioned in issue llvm/llvm-bugzilla-archive#49581

ec04fc15-fa35-46f2-80e1-5d271f2ef708 commented 3 years ago

Bug llvm/llvm-bugzilla-archive#49581 has been marked as a duplicate of this bug.

llvmbot commented 12 years ago

Bug llvm/llvm-project#4678 has been marked as a duplicate of this bug.