llvm-capstone/clang/test/Lexer/digraph.c
Jacob Bandes-Storch 33f3e630b4 [Driver] Add -fno-digraphs
Summary: Add a flag `-fno-digraphs` to disable digraphs in the lexer, similar to `-fno-operator-names` which disables alternative names for C++ operators.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

Differential Revision: https://reviews.llvm.org/D48266

llvm-svn: 337232
2018-07-17 04:56:22 +00:00

36 lines
1.0 KiB
C

// RUN: %clang_cc1 -DDIGRAPHS=1 -fsyntax-only -verify -ffreestanding %s
// RUN: %clang_cc1 -DDIGRAPHS=1 -fno-digraphs -fdigraphs -fsyntax-only -verify -ffreestanding %s
// RUN: %clang_cc1 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
// RUN: %clang_cc1 -fdigraphs -fno-digraphs -fsyntax-only -verify -ffreestanding %s
// RUN: %clang_cc1 -std=c89 -DDIGRAPHS=1 -fdigraphs -fsyntax-only -verify -ffreestanding %s
// RUN: %clang_cc1 -std=c89 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
#if DIGRAPHS
// expected-no-diagnostics
%:include <stdint.h>
%:ifndef BUFSIZE
%:define BUFSIZE 512
%:endif
void copy(char d<::>, const char s<::>, int len)
<%
while (len-- >= 0)
<%
d<:len:> = s<:len:>;
%>
%>
#else
// expected-error@+1 {{expected identifier or '('}}
%:include <stdint.h>
;
// expected-error@+1 {{expected ')'}} expected-note@+1{{to match this '('}}
void copy(char d<::>);
// expected-error@+1 {{expected function body}}
void copy() <% %>
#endif