Revert "Pedantically warn about // comments in gnu89 mode"

This reverts commit f6dff93641b2259623e686eb13a1884b8b9f4a00.

This diagnostic is also in the -Wcomment group, which is in the -Wall
group, so the diagnostic is enabled in a wider context than GCC does.
That turns out to be disruptive for the Linux kernel builds still using
-std=gnu89 because the kernel requires C source files to start with //
comments: https://kernel.org/doc/html/v5.18-rc5/process/license-rules.html#license-identifier-syntax
This commit is contained in:
Aaron Ballman 2022-05-05 18:39:13 -04:00
parent 952fa3018e
commit 1c50909f6f
4 changed files with 3 additions and 9 deletions

View File

@ -147,9 +147,6 @@ Bug Fixes
because there is no way to fully qualify the enumerator name, so this
"extension" was unintentional and useless. This fixes
`Issue 42372 <https://github.com/llvm/llvm-project/issues/42372>`_.
- Now correctly diagnose use of ``//`` comments in ``gnu89`` mode (which
matches the behavior of GCC) in addition to ``c89`` mode. This fixes
`Issue 18427 <https://github.com/llvm/llvm-project/issues/18427>`_.
Improvements to Clang's diagnostics
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -46,7 +46,7 @@ LANGSTANDARD(c94, "iso9899:199409",
LANGSTANDARD(gnu89, "gnu89",
C, "ISO C 1990 with GNU extensions",
Digraphs | GNUMode)
LineComment | Digraphs | GNUMode)
LANGSTANDARD_ALIAS(gnu89, "gnu90")
// C99-ish modes

View File

@ -1,7 +1,5 @@
/* RUN: %clang_cc1 -std=c90 -fsyntax-only %s -verify -pedantic-errors
*/
/* RUN: %clang_cc1 -std=gnu89 -fsyntax-only %s -verify -pedantic-errors
*/
enum { cast_hex = (long) (
0x0p-1 /* expected-error {{hexadecimal floating constants are a C99 feature}} */

View File

@ -1,6 +1,5 @@
/* RUN: %clang_cc1 %s -std=gnu89 -pedantic -fsyntax-only -verify
*/
// RUN: %clang_cc1 %s -std=gnu89 -pedantic -fsyntax-only -verify
int f(int restrict);
void main(void) {} /* expected-warning {{return type of 'main' is not 'int'}} expected-note {{change return type to 'int'}} */
void main(void) {} // expected-warning {{return type of 'main' is not 'int'}} expected-note {{change return type to 'int'}}