[all-commits] [llvm/llvm-project] 9791f2: [clang][sema] Add support and documentation for `_...

Aidan Goldfarb via All-commits all-commits at lists.llvm.org
Tue Dec 3 10:39:39 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9791f258079a4334c61c64cb62d9746a3db2c25c
      https://github.com/llvm/llvm-project/commit/9791f258079a4334c61c64cb62d9746a3db2c25c
  Author: Aidan Goldfarb <47676355+AidanGoldfarb at users.noreply.github.com>
  Date:   2024-12-03 (Tue, 03 Dec 2024)

  Changed paths:
    M clang/docs/LanguageExtensions.rst
    M clang/include/clang/Basic/Features.def
    M clang/test/Sema/enum.c

  Log Message:
  -----------
  [clang][sema] Add support and documentation for `__has_extension(c_fixed_enum)` (#117507)

This PR addresses #116880 

Updated
[LanguageExtensions.rst](https://github.com/llvm/llvm-project/blob/main/clang/docs/LanguageExtensions.rst)
to include support for C++11 enumerations with a fixed underlying type
in C. Included a note that this is only a language extension prior to
C23.

Updated
[Features.def](https://github.com/llvm-mirror/clang/blob/master/include/clang/Basic/Features.def)
to support for `__has_extension(c_fixed_enum)` by added it as a feature
(for C23) and an extension (for <C23).

Updated
[enum.c](https://github.com/llvm/llvm-project/blob/main/clang/test/Sema/enum.c)
to ensure support of C++11 enumerations with a fixed underlying type in
both <C23 and C23, as well as the functionality of
`__has_extension(c_fixed_enum)`.

---

In enum.c, I encountered a warning when testing enumerations with a
fixed underlying type in pre-C23 modes. Specifically, the test produces
the warning: `enumeration types with a fixed underlying type are a C23
extension`. I am unsure if this warning is expected behavior, as
enumerations with a fixed underlying type should behave identically in
pre-C23 and C23 modes. I expected that adding `c_fixed_enum` as an
extension would fix this warning. Feedback on whether this is correct or
requires adjustment would be appreciated.

I was also unsure of the best location for the additions in
`Features.def`, I would appreciate advice on this as well

Note that this is my first PR to LLVM, so please liberally critique it!



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list