xref: /llvm-project/clang/test/Sema/gnu-builtins.c (revision d7d743621a0d5d13ed54d358944857ccba598299)
1 // RUN: %clang_cc1 -fsyntax-only -verify=gnu -std=gnu17 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify=gnu -std=gnu2x %s
3 // RUN: %clang_cc1 -fsyntax-only -verify=std -std=c17 %s
4 // RUN: %clang_cc1 -fsyntax-only -verify=std -std=c2x %s
5 
6 // std-no-diagnostics
7 
8 // 'index' is a builtin library function, but only in GNU mode. So this should
9 // give an error in GNU modes but be okay in non-GNU mode.
10 // FIXME: the error is correct, but these notes are pretty awful.
11 int index; // gnu-error {{redefinition of 'index' as different kind of symbol}} \
12               gnu-note {{unguarded header; consider using #ifdef guards or #pragma once}} \
13               gnu-note {{previous definition is here}}
14