1 // RUN: %clang_cc1 -fsyntax-only -verify=pre-c2x-cpp23 %s 2 // RUN: %clang_cc1 -fsyntax-only -Wno-unknown-directives -verify=okay %s 3 // RUN: %clang_cc1 -std=c2x -fsyntax-only -verify=c2x-cpp23 %s 4 // RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify=c2x-cpp23 %s 5 // RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only %s -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s 6 // okay-no-diagnostics 7 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 UNDEFINED 20 #id 21 #ifd 22 #ifde 23 # elf 24 # elsif 25 #elseif 26 #elfidef 27 #elfindef 28 #elfinndef 29 #els 30 #endi 31 #endif 32 // 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 UNDEFINED 57 #i // no diagnostic 58 #endif 59 60 #if special_compiler 61 #special_compiler_directive // no diagnostic 62 #endif 63