File tree 3 files changed +50
-1
lines changed
3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change 5
5
* file "LICENSE" for information on usage and redistribution of this file.
6
6
*/
7
7
8
+ #ifndef SHECC_DEFS_H
9
+ #define SHECC_DEFS_H
10
+
8
11
/* definitions */
9
12
10
13
/* Limitations */
@@ -425,3 +428,5 @@ typedef struct {
425
428
var_t * var ;
426
429
int polluted ;
427
430
} regfile_t ;
431
+
432
+ #endif
Original file line number Diff line number Diff line change @@ -409,6 +409,10 @@ bool read_preproc_directive()
409
409
410
410
macro -> start_source_idx = source_idx ;
411
411
skip_macro_body ();
412
+ } else {
413
+ /* Empty alias, may be dummy alias serves as include guard */
414
+ value [0 ] = 0 ;
415
+ add_alias (alias , value );
412
416
}
413
417
414
418
return true;
Original file line number Diff line number Diff line change @@ -465,9 +465,49 @@ try_ 0 << EOF
465
465
#else
466
466
#define A 1
467
467
#endif
468
+
469
+ #ifndef A
470
+ #define B 1
471
+ #else
472
+ #define B 0
473
+ #endif
468
474
int main()
469
475
{
470
- return A;
476
+ return A + B;
477
+ }
478
+ EOF
479
+
480
+ # include guard test, simulates inclusion of a file named defs.h and global.c
481
+ try_ 0 << EOF
482
+ /* #include "defs.h" */
483
+ #ifndef DEFS_H
484
+ #define DEFS_H
485
+
486
+ #define A 1
487
+
488
+ #endif
489
+ /* end if "defs.h" inclusion */
490
+
491
+ /* #include "global.c" */
492
+ #ifndef GLOBAL_C
493
+ #define GLOBAL_C
494
+
495
+ #define B 1
496
+
497
+ /* [global.c] #include "defs.h" */
498
+ #ifndef DEFS_H
499
+ #define DEFS_H
500
+
501
+ #define A 2
502
+
503
+ #endif
504
+ /* end if "defs.h" inclusion */
505
+ #endif
506
+ /* end if "global.c" inclusion */
507
+
508
+ int main()
509
+ {
510
+ return A - B;
471
511
}
472
512
EOF
473
513
You can’t perform that action at this time.
0 commit comments