Clang Project

clang_source_code/test/Lexer/digraph.c
1// RUN: %clang_cc1 -DDIGRAPHS=1 -fsyntax-only -verify -ffreestanding %s
2// RUN: %clang_cc1 -DDIGRAPHS=1 -fno-digraphs -fdigraphs -fsyntax-only -verify -ffreestanding %s
3// RUN: %clang_cc1 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
4// RUN: %clang_cc1 -fdigraphs -fno-digraphs -fsyntax-only -verify -ffreestanding %s
5// RUN: %clang_cc1 -std=c89 -DDIGRAPHS=1 -fdigraphs -fsyntax-only -verify -ffreestanding %s
6// RUN: %clang_cc1 -std=c89 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
7
8#if DIGRAPHS
9
10// expected-no-diagnostics
11%:include <stdint.h>
12
13    %:ifndef BUFSIZE
14     %:define BUFSIZE  512
15    %:endif
16
17    void copy(char d<::>, const char s<::>, int len)
18    <%
19        while (len-- >= 0)
20        <%
21            d<:len:> = s<:len:>;
22        %>
23    %>
24#else
25
26// expected-error@+1 {{expected identifier or '('}}
27%:include <stdint.h>
28;
29// expected-error@+1 {{expected ')'}} expected-note@+1{{to match this '('}}
30void copy(char d<::>);
31
32// expected-error@+1 {{expected function body}}
33void copy() <% %>
34
35#endif
36