29 lines · c
1// RUN: %clang_analyze_cc1 -Wno-error=implicit-function-declaration -analyzer-checker=core %s \2// RUN: -analyzer-output=plist -o %t.plist \3// RUN: -analyzer-config expand-macros=true -verify4//5// RUN: FileCheck --input-file=%t.plist %s6 7#define STRANGE_FN(x) STRANGE_FN(x, 0)8void test_strange_macro_expansion(void) {9 char *path;10 STRANGE_FN(path); // no-crash11 // expected-warning@-1 {{call to undeclared function}}12 // expected-warning@-2 {{1st function call argument is an uninitialized value}}13}14 15// CHECK: <key>macro_expansions</key>16// CHECK-NEXT: <array>17// CHECK-NEXT: <dict>18// CHECK-NEXT: <key>location</key>19// CHECK-NEXT: <dict>20// CHECK-NEXT: <key>line</key><integer>10</integer>21// CHECK-NEXT: <key>col</key><integer>3</integer>22// CHECK-NEXT: <key>file</key><integer>0</integer>23// CHECK-NEXT: </dict>24// CHECK-NEXT: <key>name</key><string>STRANGE_FN(path)</string>25// CHECK-NEXT: <key>expansion</key><string>STRANGE_FN (path ,0)</string>26// CHECK-NEXT: </dict>27// CHECK-NEXT: </array>28 29