[all-commits] [llvm/llvm-project] e321c5: [C2x] Relaxing requirements for va_start
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Thu Dec 8 04:36:26 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e321c53f7bb8d61f64b33e8b1f6a97eb32eaaa69
https://github.com/llvm/llvm-project/commit/e321c53f7bb8d61f64b33e8b1f6a97eb32eaaa69
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2022-12-08 (Thu, 08 Dec 2022)
Changed paths:
M clang/docs/LanguageExtensions.rst
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Headers/stdarg.h
M clang/lib/Sema/SemaChecking.cpp
M clang/lib/Sema/SemaType.cpp
A clang/test/C/C2x/n2975.c
M clang/www/c_status.html
Log Message:
-----------
[C2x] Relaxing requirements for va_start
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.
Differential Revision: https://reviews.llvm.org/D139436
More information about the All-commits
mailing list