[cfe-commits] r41653 - /cfe/trunk/Sema/SemaExpr.cpp
Chris Lattner
sabre at nondot.org
Fri Aug 31 14:49:13 PDT 2007
Author: lattner
Date: Fri Aug 31 16:49:13 2007
New Revision: 41653
URL: http://llvm.org/viewvc/llvm-project?rev=41653&view=rev
Log:
diagnose extended uses of offsetof
Modified:
cfe/trunk/Sema/SemaExpr.cpp
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=41653&r1=41652&r2=41653&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Fri Aug 31 16:49:13 2007
@@ -1743,6 +1743,12 @@
// iteratively process the offsetof designators.
Expr *Res = new CompoundLiteralExpr(ArgTy, 0);
+ // offsetof with non-identifier designators (e.g. "offsetof(x, a.b[c])") are a
+ // GCC extension, diagnose them.
+ if (NumComponents != 1)
+ Diag(BuiltinLoc, diag::ext_offsetof_extended_field_designator,
+ SourceRange(CompPtr[1].LocStart, CompPtr[NumComponents-1].LocEnd));
+
for (unsigned i = 0; i != NumComponents; ++i) {
const OffsetOfComponent &OC = CompPtr[i];
if (OC.isBrackets) {
More information about the cfe-commits
mailing list