xref: /llvm-project/clang/test/Lexer/digraph.c (revision 33f3e630b47384db957481f7f7aca99b6f37b3a6)
1*33f3e630SJacob Bandes-Storch // RUN: %clang_cc1 -DDIGRAPHS=1 -fsyntax-only -verify -ffreestanding %s
2*33f3e630SJacob Bandes-Storch // RUN: %clang_cc1 -DDIGRAPHS=1 -fno-digraphs -fdigraphs -fsyntax-only -verify -ffreestanding %s
3*33f3e630SJacob Bandes-Storch // RUN: %clang_cc1 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
4*33f3e630SJacob Bandes-Storch // RUN: %clang_cc1 -fdigraphs -fno-digraphs -fsyntax-only -verify -ffreestanding %s
5*33f3e630SJacob Bandes-Storch // RUN: %clang_cc1 -std=c89 -DDIGRAPHS=1 -fdigraphs -fsyntax-only -verify -ffreestanding %s
6*33f3e630SJacob Bandes-Storch // RUN: %clang_cc1 -std=c89 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
74f64def9SEli Friedman 
8*33f3e630SJacob Bandes-Storch #if DIGRAPHS
9*33f3e630SJacob Bandes-Storch 
10*33f3e630SJacob Bandes-Storch // expected-no-diagnostics
11feedba68SDaniel Dunbar %:include <stdint.h>
124f64def9SEli Friedman 
134f64def9SEli Friedman     %:ifndef BUFSIZE
144f64def9SEli Friedman      %:define BUFSIZE  512
154f64def9SEli Friedman     %:endif
164f64def9SEli Friedman 
copy(char d[],const char s[],int len)174f64def9SEli Friedman     void copy(char d<::>, const char s<::>, int len)
184f64def9SEli Friedman     <%
194f64def9SEli Friedman         while (len-- >= 0)
204f64def9SEli Friedman         <%
214f64def9SEli Friedman             d<:len:> = s<:len:>;
224f64def9SEli Friedman         %>
234f64def9SEli Friedman     %>
24*33f3e630SJacob Bandes-Storch #else
25*33f3e630SJacob Bandes-Storch 
26*33f3e630SJacob Bandes-Storch // expected-error@+1 {{expected identifier or '('}}
27*33f3e630SJacob Bandes-Storch %:include <stdint.h>
28*33f3e630SJacob Bandes-Storch ;
29*33f3e630SJacob Bandes-Storch // expected-error@+1 {{expected ')'}} expected-note@+1{{to match this '('}}
30*33f3e630SJacob Bandes-Storch void copy(char d<::>);
31*33f3e630SJacob Bandes-Storch 
32*33f3e630SJacob Bandes-Storch // expected-error@+1 {{expected function body}}
copy()33*33f3e630SJacob Bandes-Storch void copy() <% %>
34*33f3e630SJacob Bandes-Storch 
35*33f3e630SJacob Bandes-Storch #endif
36