Skip to content

Commit

Permalink
[C99] Claim conformance to WG14 N570
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronBallman committed Apr 1, 2024
1 parent 2be7225 commit 4746877
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions clang/test/C/C99/n570.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// RUN: %clang_cc1 -verify -std=c99 %s
// RUN: %clang_cc1 -E -std=c99 %s | FileCheck %s
// expected-no-diagnostics

/* WG14 N570: Yes
* Empty macro arguments
*
* NB: the original paper is not available online anywhere, so the test

This comment has been minimized.

Copy link
@nickdesaulniers

nickdesaulniers Apr 1, 2024

Member

b'ah, who needs the papers anyways! 😆

oh boy, quite a few are missing from https://www.open-std.org/jtc1/sc22/wg14/www/wg14_document_log.htm

This comment has been minimized.

Copy link
@AaronBallman

AaronBallman Apr 1, 2024

Author Collaborator

Yeah, the missing papers are all from the era where the papers were physical "meeting mailings" were a box of papers shipped to you. :-D So we're missing a lot of content where the paper never made it into an electronic format.

This comment has been minimized.

Copy link
@nickdesaulniers

nickdesaulniers Apr 1, 2024

Member

interesting. How did you even get the list of what papers were titled and whom they were authored by?

This comment has been minimized.

Copy link
@AaronBallman

AaronBallman Apr 1, 2024

Author Collaborator

In order to get a document number, you have to reach out to the secretariat and ask for one, and that requires a document title and provides the author name.

The only reason I knew this was in C99 was because of editor's comments in the foreword in the copy I have.

* coverage is coming from what could be gleaned from the C99 rationale
* document. In C89, it was UB to pass no arguments to a function-like macro,
* and that's now supported in C99.
*/

#define TEN 10
#define U u
#define I // expands into no preprocessing tokens
#define L L
#define glue(a, b) a ## b
#define xglue(a, b) glue(a, b)

const unsigned u = xglue(TEN, U);
const int i = xglue(TEN, I);
const long l = xglue(TEN, L);

// CHECK: const unsigned u = 10u;
// CHECK-NEXT: const int i = 10;
// CHECK-NEXT: const long l = 10L;

_Static_assert(u == 10U, "");
_Static_assert(i == 10, "");
_Static_assert(l == 10L, "");
2 changes: 1 addition & 1 deletion clang/www/c_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ <h2 id="c99">C99 implementation status</h2>
<tr>
<td>empty macro arguments</td>
<td>N570</td>
<td class="unknown" align="center">Unknown</td>
<td class="full" align="center">Yes</td>
</tr>
<tr>
<td>new structure type compatibility (tag compatibility)</td>
Expand Down

0 comments on commit 4746877

Please sign in to comment.