llvm / llvm/llvm-project

Need to define __STDC_VERSION_STDARG_H__ as 202311L for c23 standard

Open
#191,897 4 comments 0 reactions 0 assignees View on GitHub
c23 clang:headers
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Variadic arguments with no leading arguments is one of such C23 features and is already available with -std=c23.

Since C23, standard headers introduce their own version macros like `__STDC_VERSION_HEADERNAME_H__`
See https://open-std.org/JTC1/SC22/WG14/www/docs/n3220.pdf 7.16.

Since variadic arguments with no leading arguments are already available, it would be better to define
`__STDC_VERSION_STDARG_H__`

The absence of the version macro will give developers wrong impression that the feature is unavailable.

Currently, we have a test clang/test/C/C23/n2359.c that checks that `__STDC_VERSION_STDARG_H__` is not defined.

That test-code contains the following text:
```
#include
#ifndef __STDC_VERSION_STDARG_H__
#error "__STDC_VERSION_STDARG_H__ not defined"
// expected-error@-1 {{"__STDC_VERSION_STDARG_H__ not defined"}}
#endif
```
Is there a reason why `__STDC_VERSION_STDARG_H__` macro should not be defined in stdarg.h? I will be happy to add it if approved.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.