Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 1 | // Clear and create directories |
| 2 | // RUN: rm -rf %t |
| 3 | // RUN: mkdir %t |
| 4 | // RUN: mkdir %t/cache |
| 5 | // RUN: mkdir %t/Inputs |
| 6 | |
| 7 | // Build first header file |
| 8 | // RUN: echo "#define FIRST" >> %t/Inputs/first.h |
| 9 | // RUN: cat %s >> %t/Inputs/first.h |
| 10 | |
| 11 | // Build second header file |
| 12 | // RUN: echo "#define SECOND" >> %t/Inputs/second.h |
| 13 | // RUN: cat %s >> %t/Inputs/second.h |
| 14 | |
| 15 | // Build module map file |
| 16 | // RUN: echo "module FirstModule {" >> %t/Inputs/module.map |
| 17 | // RUN: echo " header \"first.h\"" >> %t/Inputs/module.map |
| 18 | // RUN: echo "}" >> %t/Inputs/module.map |
| 19 | // RUN: echo "module SecondModule {" >> %t/Inputs/module.map |
| 20 | // RUN: echo " header \"second.h\"" >> %t/Inputs/module.map |
| 21 | // RUN: echo "}" >> %t/Inputs/module.map |
| 22 | |
| 23 | // Run test |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 24 | // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -x c++ -I%t/Inputs -verify %s -std=c++1z |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 25 | |
| 26 | #if !defined(FIRST) && !defined(SECOND) |
| 27 | #include "first.h" |
| 28 | #include "second.h" |
| 29 | #endif |
| 30 | |
| 31 | namespace AccessSpecifiers { |
| 32 | #if defined(FIRST) |
| 33 | struct S1 { |
| 34 | }; |
| 35 | #elif defined(SECOND) |
| 36 | struct S1 { |
| 37 | private: |
| 38 | }; |
| 39 | #else |
| 40 | S1 s1; |
| 41 | // expected-error@second.h:* {{'AccessSpecifiers::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 42 | // expected-note@first.h:* {{but in 'FirstModule' found end of class}} |
| 43 | #endif |
| 44 | |
| 45 | #if defined(FIRST) |
| 46 | struct S2 { |
| 47 | public: |
| 48 | }; |
| 49 | #elif defined(SECOND) |
| 50 | struct S2 { |
| 51 | protected: |
| 52 | }; |
| 53 | #else |
| 54 | S2 s2; |
| 55 | // expected-error@second.h:* {{'AccessSpecifiers::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found protected access specifier}} |
| 56 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 57 | #endif |
| 58 | } // namespace AccessSpecifiers |
| 59 | |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 60 | namespace StaticAssert { |
| 61 | #if defined(FIRST) |
| 62 | struct S1 { |
| 63 | static_assert(1 == 1, "First"); |
| 64 | }; |
| 65 | #elif defined(SECOND) |
| 66 | struct S1 { |
| 67 | static_assert(1 == 1, "Second"); |
| 68 | }; |
| 69 | #else |
| 70 | S1 s1; |
| 71 | // expected-error@second.h:* {{'StaticAssert::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with message}} |
| 72 | // expected-note@first.h:* {{but in 'FirstModule' found static assert with different message}} |
| 73 | #endif |
| 74 | |
| 75 | #if defined(FIRST) |
| 76 | struct S2 { |
| 77 | static_assert(2 == 2, "Message"); |
| 78 | }; |
| 79 | #elif defined(SECOND) |
| 80 | struct S2 { |
| 81 | static_assert(2 == 2); |
| 82 | }; |
| 83 | #else |
| 84 | S2 s2; |
| 85 | // expected-error@second.h:* {{'StaticAssert::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with no message}} |
| 86 | // expected-note@first.h:* {{but in 'FirstModule' found static assert with message}} |
| 87 | #endif |
| 88 | |
| 89 | #if defined(FIRST) |
| 90 | struct S3 { |
| 91 | static_assert(3 == 3, "Message"); |
| 92 | }; |
| 93 | #elif defined(SECOND) |
| 94 | struct S3 { |
| 95 | static_assert(3 != 4, "Message"); |
| 96 | }; |
| 97 | #else |
| 98 | S3 s3; |
| 99 | // expected-error@second.h:* {{'StaticAssert::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with condition}} |
| 100 | // expected-note@first.h:* {{but in 'FirstModule' found static assert with different condition}} |
| 101 | #endif |
| 102 | |
| 103 | #if defined(FIRST) |
| 104 | struct S4 { |
| 105 | static_assert(4 == 4, "Message"); |
| 106 | }; |
| 107 | #elif defined(SECOND) |
| 108 | struct S4 { |
| 109 | public: |
| 110 | }; |
| 111 | #else |
| 112 | S4 s4; |
| 113 | // expected-error@second.h:* {{'StaticAssert::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 114 | // expected-note@first.h:* {{but in 'FirstModule' found static assert}} |
| 115 | #endif |
| 116 | } |
| 117 | |
Richard Trieu | d078609 | 2017-02-23 00:23:01 +0000 | [diff] [blame] | 118 | namespace Field { |
| 119 | #if defined(FIRST) |
| 120 | struct S1 { |
| 121 | int x; |
| 122 | private: |
| 123 | int y; |
| 124 | }; |
| 125 | #elif defined(SECOND) |
| 126 | struct S1 { |
| 127 | int x; |
| 128 | int y; |
| 129 | }; |
| 130 | #else |
| 131 | S1 s1; |
| 132 | // expected-error@second.h:* {{'Field::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found field}} |
| 133 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 134 | #endif |
| 135 | |
| 136 | #if defined(FIRST) |
| 137 | struct S2 { |
| 138 | int x; |
| 139 | int y; |
| 140 | }; |
| 141 | #elif defined(SECOND) |
| 142 | struct S2 { |
| 143 | int y; |
| 144 | int x; |
| 145 | }; |
| 146 | #else |
| 147 | S2 s2; |
| 148 | // expected-error@second.h:* {{'Field::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'y'}} |
| 149 | // expected-note@first.h:* {{but in 'FirstModule' found field 'x'}} |
| 150 | #endif |
Richard Trieu | bcaaf96 | 2017-02-23 03:25:57 +0000 | [diff] [blame] | 151 | |
| 152 | #if defined(FIRST) |
| 153 | struct S3 { |
| 154 | double x; |
| 155 | }; |
| 156 | #elif defined(SECOND) |
| 157 | struct S3 { |
| 158 | int x; |
| 159 | }; |
| 160 | #else |
| 161 | S3 s3; |
| 162 | // expected-error@first.h:* {{'Field::S3::x' from module 'FirstModule' is not present in definition of 'Field::S3' in module 'SecondModule'}} |
| 163 | // expected-note@second.h:* {{declaration of 'x' does not match}} |
| 164 | #endif |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 165 | |
| 166 | #if defined(FIRST) |
| 167 | typedef int A; |
| 168 | struct S4 { |
| 169 | A x; |
| 170 | }; |
| 171 | |
| 172 | struct S5 { |
| 173 | A x; |
| 174 | }; |
| 175 | #elif defined(SECOND) |
| 176 | typedef int B; |
| 177 | struct S4 { |
| 178 | B x; |
| 179 | }; |
| 180 | |
| 181 | struct S5 { |
| 182 | int x; |
| 183 | }; |
| 184 | #else |
| 185 | S4 s4; |
Alex Lorenz | 76377dc | 2017-03-10 15:04:58 +0000 | [diff] [blame] | 186 | // expected-error@second.h:* {{'Field::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'Field::B' (aka 'int')}} |
| 187 | // expected-note@first.h:* {{but in 'FirstModule' found field 'x' with type 'Field::A' (aka 'int')}} |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 188 | |
| 189 | S5 s5; |
| 190 | // expected-error@second.h:* {{'Field::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with type 'int'}} |
Alex Lorenz | 76377dc | 2017-03-10 15:04:58 +0000 | [diff] [blame] | 191 | // expected-note@first.h:* {{but in 'FirstModule' found field 'x' with type 'Field::A' (aka 'int')}} |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 192 | #endif |
| 193 | |
Richard Trieu | 93772fc | 2017-02-24 20:59:28 +0000 | [diff] [blame] | 194 | #if defined(FIRST) |
| 195 | struct S6 { |
| 196 | unsigned x; |
| 197 | }; |
| 198 | #elif defined(SECOND) |
| 199 | struct S6 { |
| 200 | unsigned x : 1; |
| 201 | }; |
| 202 | #else |
| 203 | S6 s6; |
| 204 | // expected-error@second.h:* {{'Field::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found bitfield 'x'}} |
| 205 | // expected-note@first.h:* {{but in 'FirstModule' found non-bitfield 'x'}} |
| 206 | #endif |
| 207 | |
| 208 | #if defined(FIRST) |
| 209 | struct S7 { |
| 210 | unsigned x : 2; |
| 211 | }; |
| 212 | #elif defined(SECOND) |
| 213 | struct S7 { |
| 214 | unsigned x : 1; |
| 215 | }; |
| 216 | #else |
| 217 | S7 s7; |
| 218 | // expected-error@second.h:* {{'Field::S7' has different definitions in different modules; first difference is definition in module 'SecondModule' found bitfield 'x' with one width expression}} |
| 219 | // expected-note@first.h:* {{but in 'FirstModule' found bitfield 'x' with different width expression}} |
| 220 | #endif |
| 221 | |
| 222 | #if defined(FIRST) |
| 223 | struct S8 { |
| 224 | unsigned x : 2; |
| 225 | }; |
| 226 | #elif defined(SECOND) |
| 227 | struct S8 { |
| 228 | unsigned x : 1 + 1; |
| 229 | }; |
| 230 | #else |
| 231 | S8 s8; |
| 232 | // expected-error@second.h:* {{'Field::S8' has different definitions in different modules; first difference is definition in module 'SecondModule' found bitfield 'x' with one width expression}} |
| 233 | // expected-note@first.h:* {{but in 'FirstModule' found bitfield 'x' with different width expression}} |
| 234 | #endif |
Richard Trieu | 8459ddf | 2017-02-24 02:59:12 +0000 | [diff] [blame] | 235 | |
Richard Trieu | 8d543e2 | 2017-02-24 23:35:37 +0000 | [diff] [blame] | 236 | #if defined(FIRST) |
| 237 | struct S9 { |
| 238 | mutable int x; |
| 239 | }; |
| 240 | #elif defined(SECOND) |
| 241 | struct S9 { |
| 242 | int x; |
| 243 | }; |
| 244 | #else |
| 245 | S9 s9; |
| 246 | // expected-error@second.h:* {{'Field::S9' has different definitions in different modules; first difference is definition in module 'SecondModule' found non-mutable field 'x'}} |
| 247 | // expected-note@first.h:* {{but in 'FirstModule' found mutable field 'x'}} |
| 248 | #endif |
| 249 | |
| 250 | #if defined(FIRST) |
| 251 | struct S10 { |
| 252 | unsigned x = 5; |
| 253 | }; |
| 254 | #elif defined(SECOND) |
| 255 | struct S10 { |
| 256 | unsigned x; |
| 257 | }; |
| 258 | #else |
| 259 | S10 s10; |
| 260 | // expected-error@second.h:* {{'Field::S10' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with no initalizer}} |
| 261 | // expected-note@first.h:* {{but in 'FirstModule' found field 'x' with an initializer}} |
| 262 | #endif |
| 263 | |
| 264 | #if defined(FIRST) |
| 265 | struct S11 { |
| 266 | unsigned x = 5; |
| 267 | }; |
| 268 | #elif defined(SECOND) |
| 269 | struct S11 { |
| 270 | unsigned x = 7; |
| 271 | }; |
| 272 | #else |
| 273 | S11 s11; |
| 274 | // expected-error@second.h:* {{'Field::S11' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'x' with an initializer}} |
| 275 | // expected-note@first.h:* {{but in 'FirstModule' found field 'x' with a different initializer}} |
| 276 | #endif |
| 277 | |
Richard Trieu | 0255227 | 2017-05-02 23:58:52 +0000 | [diff] [blame] | 278 | #if defined(FIRST) |
| 279 | struct S12 { |
| 280 | unsigned x[5]; |
| 281 | }; |
| 282 | #elif defined(SECOND) |
| 283 | struct S12 { |
| 284 | unsigned x[7]; |
| 285 | }; |
| 286 | #else |
| 287 | S12 s12; |
| 288 | // expected-error@first.h:* {{'Field::S12::x' from module 'FirstModule' is not present in definition of 'Field::S12' in module 'SecondModule'}} |
| 289 | // expected-note@second.h:* {{declaration of 'x' does not match}} |
| 290 | #endif |
| 291 | |
| 292 | #if defined(FIRST) |
| 293 | struct S13 { |
| 294 | unsigned x[7]; |
| 295 | }; |
| 296 | #elif defined(SECOND) |
| 297 | struct S13 { |
| 298 | double x[7]; |
| 299 | }; |
| 300 | #else |
| 301 | S13 s13; |
| 302 | // expected-error@first.h:* {{'Field::S13::x' from module 'FirstModule' is not present in definition of 'Field::S13' in module 'SecondModule'}} |
| 303 | // expected-note@second.h:* {{declaration of 'x' does not match}} |
| 304 | #endif |
Richard Trieu | d078609 | 2017-02-23 00:23:01 +0000 | [diff] [blame] | 305 | } // namespace Field |
| 306 | |
Richard Trieu | 4814374 | 2017-02-28 21:24:38 +0000 | [diff] [blame] | 307 | namespace Method { |
| 308 | #if defined(FIRST) |
| 309 | struct S1 { |
| 310 | void A() {} |
| 311 | }; |
| 312 | #elif defined(SECOND) |
| 313 | struct S1 { |
| 314 | private: |
| 315 | void A() {} |
| 316 | }; |
| 317 | #else |
| 318 | S1 s1; |
| 319 | // expected-error@second.h:* {{'Method::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 320 | // expected-note@first.h:* {{but in 'FirstModule' found method}} |
| 321 | #endif |
| 322 | |
| 323 | #if defined(FIRST) |
| 324 | struct S2 { |
| 325 | void A() {} |
| 326 | void B() {} |
| 327 | }; |
| 328 | #elif defined(SECOND) |
| 329 | struct S2 { |
| 330 | void B() {} |
| 331 | void A() {} |
| 332 | }; |
| 333 | #else |
| 334 | S2 s2; |
| 335 | // expected-error@second.h:* {{'Method::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'B'}} |
| 336 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A'}} |
| 337 | #endif |
Richard Trieu | 583e2c1 | 2017-03-04 00:08:58 +0000 | [diff] [blame] | 338 | |
| 339 | #if defined(FIRST) |
| 340 | struct S3 { |
| 341 | static void A() {} |
Richard Trieu | f4b54fe | 2017-03-04 03:04:15 +0000 | [diff] [blame] | 342 | void A(int) {} |
Richard Trieu | 583e2c1 | 2017-03-04 00:08:58 +0000 | [diff] [blame] | 343 | }; |
| 344 | #elif defined(SECOND) |
| 345 | struct S3 { |
Richard Trieu | f4b54fe | 2017-03-04 03:04:15 +0000 | [diff] [blame] | 346 | void A(int) {} |
| 347 | static void A() {} |
Richard Trieu | 583e2c1 | 2017-03-04 00:08:58 +0000 | [diff] [blame] | 348 | }; |
| 349 | #else |
| 350 | S3 s3; |
| 351 | // expected-error@second.h:* {{'Method::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not static}} |
| 352 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' is static}} |
| 353 | #endif |
| 354 | |
| 355 | #if defined(FIRST) |
| 356 | struct S4 { |
| 357 | virtual void A() {} |
| 358 | void B() {} |
| 359 | }; |
| 360 | #elif defined(SECOND) |
| 361 | struct S4 { |
| 362 | void A() {} |
| 363 | virtual void B() {} |
| 364 | }; |
| 365 | #else |
| 366 | S4 s4; |
| 367 | // expected-error@second.h:* {{'Method::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not virtual}} |
| 368 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' is virtual}} |
| 369 | #endif |
| 370 | |
| 371 | #if defined(FIRST) |
| 372 | struct S5 { |
| 373 | virtual void A() = 0; |
| 374 | virtual void B() {}; |
| 375 | }; |
| 376 | #elif defined(SECOND) |
| 377 | struct S5 { |
| 378 | virtual void A() {} |
| 379 | virtual void B() = 0; |
| 380 | }; |
| 381 | #else |
| 382 | S5 *s5; |
| 383 | // expected-error@second.h:* {{'Method::S5' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is virtual}} |
| 384 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' is pure virtual}} |
| 385 | #endif |
| 386 | |
| 387 | #if defined(FIRST) |
| 388 | struct S6 { |
| 389 | inline void A() {} |
| 390 | }; |
| 391 | #elif defined(SECOND) |
| 392 | struct S6 { |
| 393 | void A() {} |
| 394 | }; |
| 395 | #else |
| 396 | S6 s6; |
| 397 | // expected-error@second.h:* {{'Method::S6' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not inline}} |
| 398 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' is inline}} |
| 399 | #endif |
| 400 | |
| 401 | #if defined(FIRST) |
| 402 | struct S7 { |
| 403 | void A() volatile {} |
| 404 | void A() {} |
| 405 | }; |
| 406 | #elif defined(SECOND) |
| 407 | struct S7 { |
| 408 | void A() {} |
| 409 | void A() volatile {} |
| 410 | }; |
| 411 | #else |
| 412 | S7 s7; |
| 413 | // expected-error@second.h:* {{'Method::S7' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not volatile}} |
| 414 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' is volatile}} |
| 415 | #endif |
| 416 | |
| 417 | #if defined(FIRST) |
| 418 | struct S8 { |
| 419 | void A() const {} |
| 420 | void A() {} |
| 421 | }; |
| 422 | #elif defined(SECOND) |
| 423 | struct S8 { |
| 424 | void A() {} |
| 425 | void A() const {} |
| 426 | }; |
| 427 | #else |
| 428 | S8 s8; |
| 429 | // expected-error@second.h:* {{'Method::S8' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' is not const}} |
| 430 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' is const}} |
| 431 | #endif |
| 432 | |
Richard Trieu | 0255227 | 2017-05-02 23:58:52 +0000 | [diff] [blame] | 433 | #if defined(FIRST) |
| 434 | struct S9 { |
| 435 | void A(int x) {} |
| 436 | void A(int x, int y) {} |
| 437 | }; |
| 438 | #elif defined(SECOND) |
| 439 | struct S9 { |
| 440 | void A(int x, int y) {} |
| 441 | void A(int x) {} |
| 442 | }; |
| 443 | #else |
| 444 | S9 s9; |
| 445 | // expected-error@second.h:* {{'Method::S9' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' that has 2 parameters}} |
| 446 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' that has 1 parameter}} |
| 447 | #endif |
| 448 | |
| 449 | #if defined(FIRST) |
| 450 | struct S10 { |
| 451 | void A(int x) {} |
| 452 | void A(float x) {} |
| 453 | }; |
| 454 | #elif defined(SECOND) |
| 455 | struct S10 { |
| 456 | void A(float x) {} |
| 457 | void A(int x) {} |
| 458 | }; |
| 459 | #else |
| 460 | S10 s10; |
| 461 | // expected-error@second.h:* {{'Method::S10' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'float'}} |
| 462 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int'}} |
| 463 | #endif |
| 464 | |
| 465 | #if defined(FIRST) |
| 466 | struct S11 { |
| 467 | void A(int x) {} |
| 468 | }; |
| 469 | #elif defined(SECOND) |
| 470 | struct S11 { |
| 471 | void A(int y) {} |
| 472 | }; |
| 473 | #else |
| 474 | S11 s11; |
| 475 | // expected-error@second.h:* {{'Method::S11' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter named 'y'}} |
| 476 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter named 'x'}} |
| 477 | #endif |
| 478 | |
| 479 | #if defined(FIRST) |
| 480 | struct S12 { |
| 481 | void A(int x) {} |
| 482 | }; |
| 483 | #elif defined(SECOND) |
| 484 | struct S12 { |
| 485 | void A(int x = 1) {} |
| 486 | }; |
| 487 | #else |
| 488 | S12 s12; |
| 489 | // TODO: This should produce an error. |
| 490 | #endif |
| 491 | |
| 492 | #if defined(FIRST) |
| 493 | struct S13 { |
| 494 | void A(int x = 1 + 0) {} |
| 495 | }; |
| 496 | #elif defined(SECOND) |
| 497 | struct S13 { |
| 498 | void A(int x = 1) {} |
| 499 | }; |
| 500 | #else |
| 501 | S13 s13; |
| 502 | // TODO: This should produce an error. |
| 503 | #endif |
| 504 | |
| 505 | #if defined(FIRST) |
| 506 | struct S14 { |
| 507 | void A(int x[2]) {} |
| 508 | }; |
| 509 | #elif defined(SECOND) |
| 510 | struct S14 { |
| 511 | void A(int x[3]) {} |
| 512 | }; |
| 513 | #else |
| 514 | S14 s14; |
| 515 | // expected-error@second.h:* {{'Method::S14' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [3]'}} |
| 516 | // expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [2]'}} |
| 517 | #endif |
Richard Trieu | 4814374 | 2017-02-28 21:24:38 +0000 | [diff] [blame] | 518 | } // namespace Method |
| 519 | |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 520 | // Naive parsing of AST can lead to cycles in processing. Ensure |
| 521 | // self-references don't trigger an endless cycles of AST node processing. |
| 522 | namespace SelfReference { |
| 523 | #if defined(FIRST) |
| 524 | template <template <int> class T> class Wrapper {}; |
| 525 | |
| 526 | template <int N> class S { |
| 527 | S(Wrapper<::SelfReference::S> &Ref) {} |
| 528 | }; |
| 529 | |
| 530 | struct Xx { |
| 531 | struct Yy { |
| 532 | }; |
| 533 | }; |
| 534 | |
| 535 | Xx::Xx::Xx::Yy yy; |
| 536 | |
| 537 | namespace NNS { |
| 538 | template <typename> struct Foo; |
| 539 | template <template <class> class T = NNS::Foo> |
| 540 | struct NestedNamespaceSpecifier {}; |
| 541 | } |
| 542 | #endif |
| 543 | } // namespace SelfReference |
| 544 | |
Richard Trieu | 33562c2 | 2017-03-08 00:13:19 +0000 | [diff] [blame] | 545 | namespace TypeDef { |
| 546 | #if defined(FIRST) |
| 547 | struct S1 { |
| 548 | typedef int a; |
| 549 | }; |
| 550 | #elif defined(SECOND) |
| 551 | struct S1 { |
| 552 | typedef double a; |
| 553 | }; |
| 554 | #else |
| 555 | S1 s1; |
| 556 | // expected-error@first.h:* {{'TypeDef::S1::a' from module 'FirstModule' is not present in definition of 'TypeDef::S1' in module 'SecondModule'}} |
| 557 | // expected-note@second.h:* {{declaration of 'a' does not match}} |
| 558 | #endif |
| 559 | |
| 560 | #if defined(FIRST) |
| 561 | struct S2 { |
| 562 | typedef int a; |
| 563 | }; |
| 564 | #elif defined(SECOND) |
| 565 | struct S2 { |
| 566 | typedef int b; |
| 567 | }; |
| 568 | #else |
| 569 | S2 s2; |
| 570 | // expected-error@first.h:* {{'TypeDef::S2::a' from module 'FirstModule' is not present in definition of 'TypeDef::S2' in module 'SecondModule'}} |
| 571 | // expected-note@second.h:* {{definition has no member 'a'}} |
| 572 | #endif |
| 573 | |
| 574 | #if defined(FIRST) |
| 575 | typedef int T; |
| 576 | struct S3 { |
| 577 | typedef T a; |
| 578 | }; |
| 579 | #elif defined(SECOND) |
| 580 | typedef double T; |
| 581 | struct S3 { |
| 582 | typedef T a; |
| 583 | }; |
| 584 | #else |
| 585 | S3 s3; |
| 586 | // expected-error@first.h:* {{'TypeDef::S3::a' from module 'FirstModule' is not present in definition of 'TypeDef::S3' in module 'SecondModule'}} |
| 587 | // expected-note@second.h:* {{declaration of 'a' does not match}} |
| 588 | #endif |
| 589 | } // namespace TypeDef |
| 590 | |
| 591 | namespace Using { |
| 592 | #if defined(FIRST) |
| 593 | struct S1 { |
| 594 | using a = int; |
| 595 | }; |
| 596 | #elif defined(SECOND) |
| 597 | struct S1 { |
| 598 | using a = double; |
| 599 | }; |
| 600 | #else |
| 601 | S1 s1; |
| 602 | // expected-error@first.h:* {{'Using::S1::a' from module 'FirstModule' is not present in definition of 'Using::S1' in module 'SecondModule'}} |
| 603 | // expected-note@second.h:* {{declaration of 'a' does not match}} |
| 604 | #endif |
| 605 | |
| 606 | #if defined(FIRST) |
| 607 | struct S2 { |
| 608 | using a = int; |
| 609 | }; |
| 610 | #elif defined(SECOND) |
| 611 | struct S2 { |
| 612 | using b = int; |
| 613 | }; |
| 614 | #else |
| 615 | S2 s2; |
| 616 | // expected-error@first.h:* {{'Using::S2::a' from module 'FirstModule' is not present in definition of 'Using::S2' in module 'SecondModule'}} |
| 617 | // expected-note@second.h:* {{definition has no member 'a'}} |
| 618 | #endif |
| 619 | |
| 620 | #if defined(FIRST) |
| 621 | typedef int T; |
| 622 | struct S3 { |
| 623 | using a = T; |
| 624 | }; |
| 625 | #elif defined(SECOND) |
| 626 | typedef double T; |
| 627 | struct S3 { |
| 628 | using a = T; |
| 629 | }; |
| 630 | #else |
| 631 | S3 s3; |
| 632 | // expected-error@first.h:* {{'Using::S3::a' from module 'FirstModule' is not present in definition of 'Using::S3' in module 'SecondModule'}} |
| 633 | // expected-note@second.h:* {{declaration of 'a' does not match}} |
| 634 | #endif |
| 635 | } // namespace Using |
| 636 | |
Hans Wennborg | 2270776 | 2017-04-12 16:40:26 +0000 | [diff] [blame] | 637 | |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 638 | // Interesting cases that should not cause errors. struct S should not error |
| 639 | // while struct T should error at the access specifier mismatch at the end. |
| 640 | namespace AllDecls { |
Richard Trieu | 0255227 | 2017-05-02 23:58:52 +0000 | [diff] [blame] | 641 | #define CREATE_ALL_DECL_STRUCT(NAME, ACCESS) \ |
| 642 | typedef int INT; \ |
| 643 | struct NAME { \ |
| 644 | public: \ |
| 645 | private: \ |
| 646 | protected: \ |
| 647 | static_assert(1 == 1, "Message"); \ |
| 648 | static_assert(2 == 2); \ |
| 649 | \ |
| 650 | int x; \ |
| 651 | double y; \ |
| 652 | \ |
| 653 | INT z; \ |
| 654 | \ |
| 655 | unsigned a : 1; \ |
| 656 | unsigned b : 2 * 2 + 5 / 2; \ |
| 657 | \ |
| 658 | mutable int c = sizeof(x + y); \ |
| 659 | \ |
| 660 | void method() {} \ |
| 661 | static void static_method() {} \ |
| 662 | virtual void virtual_method() {} \ |
| 663 | virtual void pure_virtual_method() = 0; \ |
| 664 | inline void inline_method() {} \ |
| 665 | void volatile_method() volatile {} \ |
| 666 | void const_method() const {} \ |
| 667 | \ |
| 668 | typedef int typedef_int; \ |
| 669 | using using_int = int; \ |
| 670 | \ |
| 671 | void method_one_arg(int x) {} \ |
| 672 | void method_one_arg_default_argument(int x = 5 + 5) {} \ |
| 673 | void method_decayed_type(int x[5]) {} \ |
| 674 | \ |
| 675 | int constant_arr[5]; \ |
| 676 | \ |
| 677 | ACCESS: \ |
Richard Trieu | fe56405 | 2017-04-20 02:53:53 +0000 | [diff] [blame] | 678 | }; |
| 679 | |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 680 | #if defined(FIRST) |
Richard Trieu | fe56405 | 2017-04-20 02:53:53 +0000 | [diff] [blame] | 681 | CREATE_ALL_DECL_STRUCT(S, public) |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 682 | #elif defined(SECOND) |
Richard Trieu | fe56405 | 2017-04-20 02:53:53 +0000 | [diff] [blame] | 683 | CREATE_ALL_DECL_STRUCT(S, public) |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 684 | #else |
Richard Trieu | 583e2c1 | 2017-03-04 00:08:58 +0000 | [diff] [blame] | 685 | S *s; |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 686 | #endif |
| 687 | |
| 688 | #if defined(FIRST) |
Richard Trieu | fe56405 | 2017-04-20 02:53:53 +0000 | [diff] [blame] | 689 | CREATE_ALL_DECL_STRUCT(T, private) |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 690 | #elif defined(SECOND) |
Richard Trieu | fe56405 | 2017-04-20 02:53:53 +0000 | [diff] [blame] | 691 | CREATE_ALL_DECL_STRUCT(T, public) |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 692 | #else |
Richard Trieu | 583e2c1 | 2017-03-04 00:08:58 +0000 | [diff] [blame] | 693 | T *t; |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 694 | // expected-error@second.h:* {{'AllDecls::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 695 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 696 | #endif |
| 697 | } |
| 698 | |
| 699 | namespace FriendFunction { |
| 700 | #if defined(FIRST) |
| 701 | void F(int = 0); |
| 702 | struct S { friend void F(int); }; |
| 703 | #elif defined(SECOND) |
| 704 | void F(int); |
| 705 | struct S { friend void F(int); }; |
| 706 | #else |
| 707 | S s; |
| 708 | #endif |
| 709 | |
| 710 | #if defined(FIRST) |
| 711 | void G(int = 0); |
| 712 | struct T { |
| 713 | friend void G(int); |
| 714 | |
| 715 | private: |
| 716 | }; |
| 717 | #elif defined(SECOND) |
| 718 | void G(int); |
| 719 | struct T { |
| 720 | friend void G(int); |
| 721 | |
| 722 | public: |
| 723 | }; |
| 724 | #else |
| 725 | T t; |
| 726 | // expected-error@second.h:* {{'FriendFunction::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 727 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 728 | #endif |
| 729 | } // namespace FriendFunction |
| 730 | |
| 731 | namespace ImplicitDecl { |
| 732 | #if defined(FIRST) |
| 733 | struct S { }; |
| 734 | void S_Constructors() { |
| 735 | // Trigger creation of implicit contructors |
| 736 | S foo; |
| 737 | S bar = foo; |
| 738 | S baz(bar); |
| 739 | } |
| 740 | #elif defined(SECOND) |
| 741 | struct S { }; |
| 742 | #else |
| 743 | S s; |
| 744 | #endif |
| 745 | |
| 746 | #if defined(FIRST) |
| 747 | struct T { |
| 748 | private: |
| 749 | }; |
| 750 | void T_Constructors() { |
| 751 | // Trigger creation of implicit contructors |
| 752 | T foo; |
| 753 | T bar = foo; |
| 754 | T baz(bar); |
| 755 | } |
| 756 | #elif defined(SECOND) |
| 757 | struct T { |
| 758 | public: |
| 759 | }; |
| 760 | #else |
| 761 | T t; |
| 762 | // expected-error@first.h:* {{'ImplicitDecl::T' has different definitions in different modules; first difference is definition in module 'FirstModule' found private access specifier}} |
| 763 | // expected-note@second.h:* {{but in 'SecondModule' found public access specifier}} |
| 764 | #endif |
| 765 | |
| 766 | } // namespace ImplicitDelc |
| 767 | |
| 768 | namespace TemplatedClass { |
| 769 | #if defined(FIRST) |
| 770 | template <class> |
| 771 | struct S {}; |
| 772 | #elif defined(SECOND) |
| 773 | template <class> |
| 774 | struct S {}; |
| 775 | #else |
| 776 | S<int> s; |
| 777 | #endif |
| 778 | |
| 779 | #if defined(FIRST) |
| 780 | template <class> |
| 781 | struct T { |
| 782 | private: |
| 783 | }; |
| 784 | #elif defined(SECOND) |
| 785 | template <class> |
| 786 | struct T { |
| 787 | public: |
| 788 | }; |
| 789 | #else |
| 790 | T<int> t; |
| 791 | // expected-error@second.h:* {{'TemplatedClass::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 792 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 793 | #endif |
| 794 | } // namespace TemplatedClass |
| 795 | |
| 796 | namespace TemplateClassWithField { |
| 797 | #if defined(FIRST) |
| 798 | template <class A> |
| 799 | struct S { |
| 800 | A a; |
| 801 | }; |
| 802 | #elif defined(SECOND) |
| 803 | template <class A> |
| 804 | struct S { |
| 805 | A a; |
| 806 | }; |
| 807 | #else |
| 808 | S<int> s; |
| 809 | #endif |
| 810 | |
| 811 | #if defined(FIRST) |
| 812 | template <class A> |
| 813 | struct T { |
| 814 | A a; |
| 815 | |
| 816 | private: |
| 817 | }; |
| 818 | #elif defined(SECOND) |
| 819 | template <class A> |
| 820 | struct T { |
| 821 | A a; |
| 822 | |
| 823 | public: |
| 824 | }; |
| 825 | #else |
| 826 | T<int> t; |
| 827 | // expected-error@second.h:* {{'TemplateClassWithField::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}} |
| 828 | // expected-note@first.h:* {{but in 'FirstModule' found private access specifier}} |
| 829 | #endif |
| 830 | } // namespace TemplateClassWithField |
| 831 | |
| 832 | namespace TemplateClassWithTemplateField { |
| 833 | #if defined(FIRST) |
| 834 | template <class A> |
| 835 | class WrapperS; |
| 836 | template <class A> |
| 837 | struct S { |
| 838 | WrapperS<A> a; |
| 839 | }; |
| 840 | #elif defined(SECOND) |
| 841 | template <class A> |
| 842 | class WrapperS; |
| 843 | template <class A> |
| 844 | struct S { |
| 845 | WrapperS<A> a; |
| 846 | }; |
| 847 | #else |
| 848 | template <class A> |
| 849 | class WrapperS{}; |
| 850 | S<int> s; |
| 851 | #endif |
| 852 | |
| 853 | #if defined(FIRST) |
| 854 | template <class A> |
| 855 | class WrapperT; |
| 856 | template <class A> |
| 857 | struct T { |
| 858 | WrapperT<A> a; |
| 859 | |
| 860 | public: |
| 861 | }; |
| 862 | #elif defined(SECOND) |
| 863 | template <class A> |
| 864 | class WrapperT; |
| 865 | template <class A> |
| 866 | struct T { |
| 867 | WrapperT<A> a; |
| 868 | |
| 869 | private: |
| 870 | }; |
| 871 | #else |
| 872 | template <class A> |
| 873 | class WrapperT{}; |
| 874 | T<int> t; |
| 875 | // expected-error@second.h:* {{'TemplateClassWithTemplateField::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 876 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 877 | #endif |
| 878 | } // namespace TemplateClassWithTemplateField |
| 879 | |
| 880 | namespace EnumWithForwardDeclaration { |
| 881 | #if defined(FIRST) |
| 882 | enum E : int; |
| 883 | struct S { |
| 884 | void get(E) {} |
| 885 | }; |
| 886 | #elif defined(SECOND) |
| 887 | enum E : int { A, B }; |
| 888 | struct S { |
| 889 | void get(E) {} |
| 890 | }; |
| 891 | #else |
| 892 | S s; |
| 893 | #endif |
| 894 | |
| 895 | #if defined(FIRST) |
| 896 | struct T { |
| 897 | void get(E) {} |
| 898 | public: |
| 899 | }; |
| 900 | #elif defined(SECOND) |
| 901 | struct T { |
| 902 | void get(E) {} |
| 903 | private: |
| 904 | }; |
| 905 | #else |
| 906 | T t; |
| 907 | // expected-error@second.h:* {{'EnumWithForwardDeclaration::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 908 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 909 | #endif |
| 910 | } // namespace EnumWithForwardDeclaration |
| 911 | |
| 912 | namespace StructWithForwardDeclaration { |
| 913 | #if defined(FIRST) |
| 914 | struct P {}; |
| 915 | struct S { |
| 916 | struct P *ptr; |
| 917 | }; |
| 918 | #elif defined(SECOND) |
| 919 | struct S { |
| 920 | struct P *ptr; |
| 921 | }; |
| 922 | #else |
| 923 | S s; |
| 924 | #endif |
| 925 | |
| 926 | #if defined(FIRST) |
| 927 | struct Q {}; |
| 928 | struct T { |
| 929 | struct Q *ptr; |
| 930 | public: |
| 931 | }; |
| 932 | #elif defined(SECOND) |
| 933 | struct T { |
| 934 | struct Q *ptr; |
| 935 | private: |
| 936 | }; |
| 937 | #else |
| 938 | T t; |
| 939 | // expected-error@second.h:* {{'StructWithForwardDeclaration::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 940 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 941 | #endif |
| 942 | } // namespace StructWithForwardDeclaration |
| 943 | |
| 944 | namespace StructWithForwardDeclarationNoDefinition { |
| 945 | #if defined(FIRST) |
| 946 | struct P; |
| 947 | struct S { |
| 948 | struct P *ptr; |
| 949 | }; |
| 950 | #elif defined(SECOND) |
| 951 | struct S { |
| 952 | struct P *ptr; |
| 953 | }; |
| 954 | #else |
| 955 | S s; |
| 956 | #endif |
| 957 | |
| 958 | #if defined(FIRST) |
| 959 | struct Q; |
| 960 | struct T { |
| 961 | struct Q *ptr; |
| 962 | |
| 963 | public: |
| 964 | }; |
| 965 | #elif defined(SECOND) |
| 966 | struct T { |
| 967 | struct Q *ptr; |
| 968 | |
| 969 | private: |
| 970 | }; |
| 971 | #else |
| 972 | T t; |
| 973 | // expected-error@second.h:* {{'StructWithForwardDeclarationNoDefinition::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} |
| 974 | // expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} |
| 975 | #endif |
| 976 | } // namespace StructWithForwardDeclarationNoDefinition |
| 977 | |
Richard Trieu | fe56405 | 2017-04-20 02:53:53 +0000 | [diff] [blame] | 978 | namespace LateParsedDefaultArgument { |
| 979 | #if defined(FIRST) |
| 980 | template <typename T> |
| 981 | struct S { |
| 982 | struct R { |
| 983 | void foo(T x = 0) {} |
| 984 | }; |
| 985 | }; |
| 986 | #elif defined(SECOND) |
| 987 | #else |
| 988 | void run() { |
| 989 | S<int>::R().foo(); |
| 990 | } |
| 991 | #endif |
| 992 | } |
| 993 | |
| 994 | namespace LateParsedDefaultArgument { |
| 995 | #if defined(FIRST) |
| 996 | template <typename alpha> struct Bravo { |
| 997 | void charlie(bool delta = false) {} |
| 998 | }; |
| 999 | typedef Bravo<char> echo; |
| 1000 | echo foxtrot; |
| 1001 | |
| 1002 | Bravo<char> golf; |
| 1003 | #elif defined(SECOND) |
| 1004 | #else |
| 1005 | #endif |
| 1006 | } |
| 1007 | |
Richard Trieu | 157ed94 | 2017-04-28 22:03:28 +0000 | [diff] [blame] | 1008 | namespace DifferentParameterNameInTemplate { |
| 1009 | #if defined(FIRST) || defined(SECOND) |
| 1010 | template <typename T> |
| 1011 | struct S { |
| 1012 | typedef T Type; |
| 1013 | |
| 1014 | static void Run(const Type *name_one); |
| 1015 | }; |
| 1016 | |
| 1017 | template <typename T> |
| 1018 | void S<T>::Run(const T *name_two) {} |
| 1019 | |
| 1020 | template <typename T> |
| 1021 | struct Foo { |
| 1022 | ~Foo() { Handler::Run(nullptr); } |
| 1023 | Foo() {} |
| 1024 | |
| 1025 | class Handler : public S<T> {}; |
| 1026 | |
| 1027 | void Get(typename Handler::Type *x = nullptr) {} |
| 1028 | void Add() { Handler::Run(nullptr); } |
| 1029 | }; |
| 1030 | #endif |
| 1031 | |
| 1032 | #if defined(FIRST) |
| 1033 | struct Beta; |
| 1034 | |
| 1035 | struct Alpha { |
| 1036 | Alpha(); |
| 1037 | void Go() { betas.Get(); } |
| 1038 | Foo<Beta> betas; |
| 1039 | }; |
| 1040 | |
| 1041 | #elif defined(SECOND) |
| 1042 | struct Beta {}; |
| 1043 | |
| 1044 | struct BetaHelper { |
| 1045 | void add_Beta() { betas.Add(); } |
| 1046 | Foo<Beta> betas; |
| 1047 | }; |
| 1048 | |
| 1049 | #else |
| 1050 | Alpha::Alpha() {} |
| 1051 | #endif |
| 1052 | } |
| 1053 | |
Richard Trieu | 0255227 | 2017-05-02 23:58:52 +0000 | [diff] [blame] | 1054 | namespace ParameterTest { |
| 1055 | #if defined(FIRST) |
| 1056 | class X {}; |
| 1057 | template <typename G> |
| 1058 | class S { |
| 1059 | public: |
| 1060 | typedef G Type; |
| 1061 | static inline G *Foo(const G *a, int * = nullptr); |
| 1062 | }; |
| 1063 | |
| 1064 | template<typename G> |
| 1065 | G* S<G>::Foo(const G* aaaa, int*) {} |
| 1066 | #elif defined(SECOND) |
| 1067 | template <typename G> |
| 1068 | class S { |
| 1069 | public: |
| 1070 | typedef G Type; |
| 1071 | static inline G *Foo(const G *a, int * = nullptr); |
| 1072 | }; |
| 1073 | |
| 1074 | template<typename G> |
| 1075 | G* S<G>::Foo(const G* asdf, int*) {} |
| 1076 | #else |
| 1077 | S<X> s; |
| 1078 | #endif |
| 1079 | } |
| 1080 | |
Richard Trieu | b35ef2a | 2017-05-09 03:24:34 +0000 | [diff] [blame^] | 1081 | namespace MultipleTypedefs { |
| 1082 | #if defined(FIRST) |
| 1083 | typedef int B1; |
| 1084 | typedef B1 A1; |
| 1085 | struct S1 { |
| 1086 | A1 x; |
| 1087 | }; |
| 1088 | #elif defined(SECOND) |
| 1089 | typedef int A1; |
| 1090 | struct S1 { |
| 1091 | A1 x; |
| 1092 | }; |
| 1093 | #else |
| 1094 | S1 s1; |
| 1095 | #endif |
| 1096 | |
| 1097 | #if defined(FIRST) |
| 1098 | struct T2 { int x; }; |
| 1099 | typedef T2 B2; |
| 1100 | typedef B2 A2; |
| 1101 | struct S2 { |
| 1102 | T2 x; |
| 1103 | }; |
| 1104 | #elif defined(SECOND) |
| 1105 | struct T2 { int x; }; |
| 1106 | typedef T2 A2; |
| 1107 | struct S2 { |
| 1108 | T2 x; |
| 1109 | }; |
| 1110 | #else |
| 1111 | S2 s2; |
| 1112 | #endif |
| 1113 | } |
Richard Trieu | 0255227 | 2017-05-02 23:58:52 +0000 | [diff] [blame] | 1114 | |
Richard Trieu | e7f7ed2 | 2017-02-22 01:11:25 +0000 | [diff] [blame] | 1115 | // Keep macros contained to one file. |
| 1116 | #ifdef FIRST |
| 1117 | #undef FIRST |
| 1118 | #endif |
| 1119 | #ifdef SECOND |
| 1120 | #undef SECOND |
| 1121 | #endif |