summaryrefslogtreecommitdiff
path: root/clang/test/Sema/gnu-builtins.c
blob: c4da8b39363cddba88105612ac208d110e2b9b23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// RUN: %clang_cc1 -fsyntax-only -verify=gnu -std=gnu17 %s
// RUN: %clang_cc1 -fsyntax-only -verify=gnu -std=gnu2x %s
// RUN: %clang_cc1 -fsyntax-only -verify=std -std=c17 %s
// RUN: %clang_cc1 -fsyntax-only -verify=std -std=c2x %s

// std-no-diagnostics

// 'index' is a builtin library function, but only in GNU mode. So this should
// give an error in GNU modes but be okay in non-GNU mode.
// FIXME: the error is correct, but these notes are pretty awful.
int index; // gnu-error {{redefinition of 'index' as different kind of symbol}} \
              gnu-note {{unguarded header; consider using #ifdef guards or #pragma once}} \
              gnu-note {{previous definition is here}}