[PATCH] D139436: [C2x] Relaxing requirements for va_start
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 6 08:31:23 PST 2022
aaron.ballman created this revision.
aaron.ballman added reviewers: clang-language-wg, efriedma, jyknight, hubert.reinterpretcast.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.
This implements WG14 N2975 relaxing requirements for va_start (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2975.pdf), which does two things:
1. Allows the declaration of a variadic function without any named arguments. e.g., `void f(...)` is now valid, as in C++.
2. Modified the signature of the `va_start` macro to be a variadic macro that accepts one or more arguments; the second (and later) arguments are not expanded or evaluated.
I followed the GCC implementation in terms of not modifying the behavior of `__builtin_va_start` (it still requires exactly two arguments), but this approach has led to several QoI issues that I've documented with FIXME comments in the test. Specifically, the requirement that we do not evaluate *or expand* the second and later arguments means it's no longer possible to issue diagnostics for compatibility with older C versions and C++. I am reaching out to folks in WG14 to see if we can get an NB comment to address these concerns (the US comment period has already closed, so I cannot file the comment myself), so the diagnostic behavior may change in the future.
I took this opportunity to add some documentation for all the related builtins in this area, since there was no documentation for them yet.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139436
Files:
clang/docs/LanguageExtensions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticCommonKinds.td
clang/lib/Headers/stdarg.h
clang/lib/Parse/ParseDecl.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaType.cpp
clang/test/C/C2x/n2975.c
clang/www/c_status.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139436.480501.patch
Type: text/x-patch
Size: 12642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221206/8417a4ff/attachment-0001.bin>
More information about the cfe-commits
mailing list