On Aug 20, 2009, at 10:48 AM, Sanjiv Gupta wrote: > Author: sgupta > Date: Thu Aug 20 12:48:52 2009 > New Revision: 79544 > > URL: http://llvm.org/viewvc/llvm-project?rev=79544&view=rev > Log: > Issue an error if the user specifies parameters in a function marked > as ISR.
Sanjiv, doing a strcmp with the target in SemaDecl is not appropriate here, please revert this and discuss it on cfe-dev. -Chris > > Modified: > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > cfe/trunk/lib/Basic/Targets.cpp > cfe/trunk/lib/Sema/SemaDecl.cpp > > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=79544&r1=79543&r2=79544&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Aug 20 > 12:48:52 2009 > @@ -76,7 +76,9 @@ > InGroup<UnusedParameter>, DefaultIgnore; > def warn_decl_in_param_list : Warning< > "declaration of %0 will not be visible outside of this function">; > - > +def warn_ISR_has_arguments : Warning< > + "Interrupt Service Routine (%0) has arguments">; > + > def warn_implicit_function_decl : Warning< > "implicit declaration of function %0">, > InGroup<ImplicitFunctionDeclare>, DefaultIgnore; > > Modified: cfe/trunk/lib/Basic/Targets.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=79544&r1=79543&r2=79544&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- cfe/trunk/lib/Basic/Targets.cpp (original) > +++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 20 12:48:52 2009 > @@ -1247,9 +1247,14 @@ > Define(Defines, "__pic16"); > Define(Defines, "rom", "__attribute__((address_space(1)))"); > Define(Defines, "ram", "__attribute__((address_space(0)))"); > - Define(Defines, "_section(SectName)", > "__attribute__((section(SectName)))"); > - Define(Defines, > "_address(Addr)","__attribute__((section(\"Address=\"#Addr)))"); > + Define(Defines, "_section(SectName)", > + "__attribute__((section(SectName)))"); > + Define(Defines, "_address(Addr)", > + "__attribute__((section(\"Address=\"#Addr)))"); > Define(Defines, "_CONFIG(conf)", "asm(\"CONFIG \"#conf)"); > + Define(Defines, "_interrupt", > + "__attribute__((section(\"interrupt=0x4\"))) \ > + __attribute__((used))"); > } > virtual void getTargetBuiltins(const Builtin::Info *&Records, > unsigned &NumRecords) const {} > > Modified: cfe/trunk/lib/Sema/SemaDecl.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=79544&r1=79543&r2=79544&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Aug 20 12:48:52 2009 > @@ -1240,6 +1240,22 @@ > /// parameters are complete. > bool Sema::CheckParmsForFunctionDef(FunctionDecl *FD) { > bool HasInvalidParm = false; > + > + // PIC16 uses section string to encode the info about ISR. > + // Flash error if ISR has arguments. > + const char *TargetPrefix = Context.Target.getTargetPrefix(); > + if (strcmp(TargetPrefix, "pic16") == 0) { > + unsigned ParamCount = FD->getNumParams(); > + if (const SectionAttr *SA = FD->getAttr<SectionAttr>()) { > + const std::string &SecString = SA->getName(); > + if (SecString.find("interrupt") != std::string::npos > + && ParamCount > 0) { > + Diag(FD->getLocation(), diag::warn_ISR_has_arguments) > + << FD->getNameAsString(); > + } > + } > + } > + > for (unsigned p = 0, NumParams = FD->getNumParams(); p < > NumParams; ++p) { > ParmVarDecl *Param = FD->getParamDecl(p); > > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
