63 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify=pre-c2x-cpp23 %s2// RUN: %clang_cc1 -fsyntax-only -Wno-unknown-directives -verify=okay %s3// RUN: %clang_cc1 -std=c2x -fsyntax-only -verify=c2x-cpp23 %s4// RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify=c2x-cpp23 %s5// RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only %s -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s6// okay-no-diagnostics7 8// id: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#if'?}}9// ifd: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#if'?}}10// ifde: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#ifdef'?}}11// elf: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}12// elsif: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}13// elseif: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}14// elfidef: not suggested to '#elifdef'15// elfindef: not suggested to '#elifdef'16// elfinndef: not suggested to '#elifndef'17// els: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#else'?}}18// endi: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#endif'?}}19#ifdef UNDEFINED20#id21#ifd22#ifde23# elf24# elsif25#elseif26#elfidef27#elfindef28#elfinndef29#els30#endi31#endif32// id: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#if'?}}33// ifd: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#if'?}}34// ifde: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#ifdef'?}}35// elf: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}36// elsif: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}37// elseif: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}38// elfidef: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elifdef'?}}39// elfindef: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elifdef'?}}40// elfinndef: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elifndef'?}}41// els: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#else'?}}42// endi: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#endif'?}}43 44// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:4}:"if"45// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:5}:"if"46// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:6}:"ifdef"47// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:3-[[@LINE-24]]:6}:"elif"48// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:4-[[@LINE-24]]:9}:"elif"49// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:8}:"elif"50// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:9}:"elifdef"51// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:10}:"elifdef"52// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:11}:"elifndef"53// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:5}:"else"54// CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:6}:"endif"55 56#ifdef UNDEFINED57#i // no diagnostic58#endif59 60#if special_compiler61#special_compiler_directive // no diagnostic62#endif63