[cfe-commits] r102501 - in /cfe/trunk: lib/AST/ASTContext.cpp test/Sema/attr-regparm.c
Daniel Dunbar
daniel at zuster.org
Wed Apr 28 09:20:58 PDT 2010
Author: ddunbar
Date: Wed Apr 28 11:20:58 2010
New Revision: 102501
URL: http://llvm.org/viewvc/llvm-project?rev=102501&view=rev
Log:
Revert "Fix for PR6953: per gcc, regparm and noreturn affect the compatibility of", it is breaking the builds of quite a few projects (emacs, dovecot, gnutar, bison).
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/Sema/attr-regparm.c
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=102501&r1=102500&r2=102501&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Apr 28 11:20:58 2010
@@ -4311,16 +4311,21 @@
allLTypes = false;
if (getCanonicalType(retType) != getCanonicalType(rbase->getResultType()))
allRTypes = false;
-
- // Check misc function attributes
+ // FIXME: double check this
+ // FIXME: should we error if lbase->getRegParmAttr() != 0 &&
+ // rbase->getRegParmAttr() != 0 &&
+ // lbase->getRegParmAttr() != rbase->getRegParmAttr()?
FunctionType::ExtInfo lbaseInfo = lbase->getExtInfo();
FunctionType::ExtInfo rbaseInfo = rbase->getExtInfo();
- // Per gcc, compatible functions must have compatible regparm and noreturn
- // attributes.
- unsigned RegParm = lbaseInfo.getRegParm();
- bool NoReturn = lbaseInfo.getNoReturn();
- if (NoReturn != rbaseInfo.getNoReturn() || RegParm != rbaseInfo.getRegParm())
- return QualType();
+ unsigned RegParm = lbaseInfo.getRegParm() == 0 ? rbaseInfo.getRegParm() :
+ lbaseInfo.getRegParm();
+ bool NoReturn = lbaseInfo.getNoReturn() || rbaseInfo.getNoReturn();
+ if (NoReturn != lbaseInfo.getNoReturn() ||
+ RegParm != lbaseInfo.getRegParm())
+ allLTypes = false;
+ if (NoReturn != rbaseInfo.getNoReturn() ||
+ RegParm != rbaseInfo.getRegParm())
+ allRTypes = false;
CallingConv lcc = lbaseInfo.getCC();
CallingConv rcc = rbaseInfo.getCC();
// Compatible functions must have compatible calling conventions
Modified: cfe/trunk/test/Sema/attr-regparm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-regparm.c?rev=102501&r1=102500&r2=102501&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-regparm.c (original)
+++ cfe/trunk/test/Sema/attr-regparm.c Wed Apr 28 11:20:58 2010
@@ -1,11 +1,7 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
-__attribute((regparm(2))) int a(void);
-__attribute((regparm(1.0))) int b(void); // expected-error{{'regparm' attribute requires integer constant}}
-__attribute((regparm(-1))) int c(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
-__attribute((regparm(5))) int d(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
-__attribute((regparm(5,3))) int e(void); // expected-error{{attribute requires 1 argument(s)}}
-int f(void);
-__attribute((regparm(0))) int f(void);
-__attribute((regparm(1))) int g(void); // expected-note{{previous declaration is here}}
-__attribute((regparm(2))) int g(void); // expected-error{{conflicting types for 'g'}}
+__attribute((regparm(2))) int x(void);
+__attribute((regparm(1.0))) int x(void); // expected-error{{'regparm' attribute requires integer constant}}
+__attribute((regparm(-1))) int x(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
+__attribute((regparm(5))) int x(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
+__attribute((regparm(5,3))) int x(void); // expected-error{{attribute requires 1 argument(s)}}
More information about the cfe-commits
mailing list