r244286 - Continue the work from r243908 by adding a Features field to Builtin::Info

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 22:44:42 PDT 2015


I think it is on by default for clang builds

    # Turn off missing field initializer warnings for gcc to avoid noise
from
    # false positives with empty {}. Turn them on otherwise (they're off by
    # default for clang).
    check_cxx_compiler_flag("-Wmissing-field-initializers"
CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG)
    if (CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG)
      if (CMAKE_COMPILER_IS_GNUCXX)
        append("-Wno-missing-field-initializers" CMAKE_C_FLAGS
CMAKE_CXX_FLAGS)
      else()
        append("-Wmissing-field-initializers" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
      endif()
    endif()

On Thu, Aug 6, 2015 at 10:35 PM, Eric Christopher <echristo at gmail.com>
wrote:

> Ah thanks Craig. Perhaps we should turn that one on by default?
>
> On Thu, Aug 6, 2015, 10:17 PM Craig Topper <craig.topper at gmail.com> wrote:
>
>> This was causing -Wmissing-field-initializers to fire due to Features not
>> being assigned in BUILTIN or LIBBUILTIN macro expansions. Fixed it in
>> r244307.
>>
>> On Thu, Aug 6, 2015 at 3:11 PM, Eric Christopher via cfe-commits <
>> cfe-commits at lists.llvm.org> wrote:
>>
>>> Author: echristo
>>> Date: Thu Aug  6 17:11:54 2015
>>> New Revision: 244286
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=244286&view=rev
>>> Log:
>>> Continue the work from r243908 by adding a Features field to
>>> Builtin::Info
>>> so that we can populate it on a per-target basis with required features.
>>>
>>> Future commits will start using this information for warnings.
>>>
>>> Modified:
>>>     cfe/trunk/include/clang/Basic/Builtins.h
>>>     cfe/trunk/lib/Basic/Targets.cpp
>>>
>>> Modified: cfe/trunk/include/clang/Basic/Builtins.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=244286&r1=244285&r2=244286&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/include/clang/Basic/Builtins.h (original)
>>> +++ cfe/trunk/include/clang/Basic/Builtins.h Thu Aug  6 17:11:54 2015
>>> @@ -51,6 +51,7 @@ enum ID {
>>>  struct Info {
>>>    const char *Name, *Type, *Attributes, *HeaderName;
>>>    LanguageID Langs;
>>> +  const char *Features;
>>>  };
>>>
>>>  /// \brief Holds information about both target-independent and
>>> @@ -166,6 +167,10 @@ public:
>>>      return strchr(getRecord(ID).Attributes, 'e') != nullptr;
>>>    }
>>>
>>> +  const char *getRequiredFeatures(unsigned ID) const {
>>> +    return getRecord(ID).Features;
>>> +  }
>>> +
>>>  private:
>>>    const Info &getRecord(unsigned ID) const;
>>>
>>>
>>> Modified: cfe/trunk/lib/Basic/Targets.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=244286&r1=244285&r2=244286&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/Basic/Targets.cpp (original)
>>> +++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug  6 17:11:54 2015
>>> @@ -2001,8 +2001,10 @@ void AMDGPUTargetInfo::getGCCRegNames(co
>>>  // Namespace for x86 abstract base class
>>>  const Builtin::Info BuiltinInfo[] = {
>>>  #define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES },
>>> -#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\
>>> -                                              ALL_LANGUAGES },
>>> +#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER)
>>>         \
>>> +  { #ID, TYPE, ATTRS, HEADER, ALL_LANGUAGES },
>>> +#define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE)
>>>        \
>>> +  { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES, FEATURE },
>>>  #include "clang/Basic/BuiltinsX86.def"
>>>  };
>>>
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
>>
>> --
>> ~Craig
>>
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150806/b305b662/attachment.html>


More information about the cfe-commits mailing list