aaron.ballman added inline comments.
================ Comment at: lib/Sema/SemaDeclAttr.cpp:1990 -bool Sema::CheckNoReturnAttr(const AttributeList &Attrs) { - if (!checkAttributeNumArgs(*this, Attrs, 0)) { - Attrs.setInvalid(); +static void handleNoCfCheckAttr(Sema &S, Decl *D, const AttributeList &attr) { + if (S.CheckAttrTarget(attr) || S.CheckAttrNoArgs(attr)) ---------------- oren_ben_simhon wrote: > aaron.ballman wrote: > > oren_ben_simhon wrote: > > > aaron.ballman wrote: > > > > aaron.ballman wrote: > > > > > `attr` doesn't follow the proper naming conventions. > > > > Please don't name the parameter variable after a type -- that can > > > > confuse some editors. > > > I am following the same convention that other functions are using. > > > I am following the same convention that other functions are using. > > > > They're doing it wrong. I can clean those up in a separate patch. > Its OK i can make the change. I've commit a cleanup in r325256 that fixes the identifiers in the file (along with several other coding standard issues). ================ Comment at: test/Sema/attr-nocf_check.c:18-20 + FuncPointerWithNoCfCheck fNoCfCheck = f; // no-warning + (*fNoCfCheck)(); // no-warning + f = fNoCfCheck; // no-warning ---------------- oren_ben_simhon wrote: > aaron.ballman wrote: > > oren_ben_simhon wrote: > > > aaron.ballman wrote: > > > > These are an error in GCC and I think we should match that behavior. > > > > https://godbolt.org/g/r3pf4X > > > I will create a warning however in LLVM we don't create an error upon > > > incompatible pointer due to function attribute types. > > It should be an error -- Clang does error on this sort of thing when > > appropriate (which I believe it is, here). For instance, calling convention > > attributes do this: https://godbolt.org/g/mkTGLg > In Clang there is Sema::IncompatiblePointer in case to pointers are not > compatible. This flag emits warning message. In the time i check for pointer > incompatibility (checkPointerTypesForAssignment()), i don;t have a handle to > the attributes. Any suggestion how to implement the exception for nocf_check > attribute? I believe this is handled in `ASTContext::mergeFunctionType()`. See: ``` // Compatible functions must have compatible calling conventions if (lbaseInfo.getCC() != rbaseInfo.getCC()) return QualType(); ``` Somewhere around there is likely where you should be. Repository: rL LLVM https://reviews.llvm.org/D41880 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits