Skip to content

Test doesn't compile #47

@yinghao-w

Description

@yinghao-w

Describe the bug

The test doesn't compile. There is an implicit function declaration error which can be fixed by adding -Wno-error=implicit-function-declaration to CFLAGS in /test/Makefile. Also there is an undefined reference to ``cmc_assert_equals_bool'. It seems that the macro cmc_assert_equals(bool,... is not expanding to the function cmc_assert_equals__Bool in /cmc/utl/assert.h. Seems like just a typo; if I edit the _Bool part to bool it compiles successfully.

How to Reproduce

Run make tests.

Add -Wno-error=implicit-function-declaration to CFLAGS in /tests/Makefile.

Run make tests.

Expected behavior

Test runs successfully.

Screenshots

make -C ./tests
make[1]: Entering directory '/home/yinghao/dev/C-Macro-Collections/tests'
mkdir -p ./out
gcc ./main.c -I .. -Wall -Wextra -Werror -fprofile-arcs -ftest-coverage -ftime-report -g -O0 -DCMC_CALLBACKS -o ./out/main.exe
In file included from ./utl.h:13,
                 from ./unt_bitset.h:4,
                 from ./main.c:12:
./unt_deque.h: In function ‘CMCDequeIter’:
../cmc/utl/assert.h:85:44: error: implicit declaration of function ‘cmc_assert_equals_bool’; did you mean ‘cmc_assert_equals__Bool’? [-Wimplicit-function-declaration]
   85 | #define CMC_ASSERT_GLUE_(dtype, assertion) cmc_assert_##assertion##_##dtype
      |                                            ^~~~~~~~~~~
../cmc/utl/test.h:160:9: note: in definition of macro ‘CMC_CREATE_UNIT’
  160 |         BODY; \
      |         ^~~~
./unt_deque.h:1170:5: note: in expansion of macro ‘CMC_CREATE_TEST’
 1170 |     CMC_CREATE_TEST(PFX##_iter_start(), {
      |     ^~~~~~~~~~~~~~~
../cmc/utl/assert.h:86:43: note: in expansion of macro ‘CMC_ASSERT_GLUE_’
   86 | #define CMC_ASSERT_GLUE(dtype, assertion) CMC_ASSERT_GLUE_(dtype, assertion)
      |                                           ^~~~~~~~~~~~~~~~
../cmc/utl/assert.h:136:5: note: in expansion of macro ‘CMC_ASSERT_GLUE’
  136 |     CMC_ASSERT_GLUE(dtype, equals) \
      |     ^~~~~~~~~~~~~~~
./unt_deque.h:1180:9: note: in expansion of macro ‘cmc_assert_equals’
 1180 |         cmc_assert_equals(bool, true, it.start);
      |

make -C ./tests
make[1]: Entering directory '/home/yinghao/dev/C-Macro-Collections/tests'
mkdir -p ./out
gcc ./main.c -I .. -Wall -Wextra -Werror -fprofile-arcs -ftest-coverage -ftime-report -g -O0 -DCMC_CALLBACKS	-Wno-error=implicit-function-declaration -o ./out/main.exe
In file included from ./utl.h:13,
                 from ./unt_bitset.h:4,
                 from ./main.c:12:
./unt_deque.h: In function ‘CMCDequeIter’:
../cmc/utl/assert.h:85:44: warning: implicit declaration of function ‘cmc_assert_equals_bool’; did you mean ‘cmc_assert_equals__Bool’? [-Wimplicit-function-declaration]
   85 | #define CMC_ASSERT_GLUE_(dtype, assertion) cmc_assert_##assertion##_##dtype
      |                                            ^~~~~~~~~~~
../cmc/utl/test.h:160:9: note: in definition of macro ‘CMC_CREATE_UNIT’
  160 |         BODY; \
      |         ^~~~
./unt_deque.h:1170:5: note: in expansion of macro ‘CMC_CREATE_TEST’
 1170 |     CMC_CREATE_TEST(PFX##_iter_start(), {
      |     ^~~~~~~~~~~~~~~
../cmc/utl/assert.h:86:43: note: in expansion of macro ‘CMC_ASSERT_GLUE_’
   86 | #define CMC_ASSERT_GLUE(dtype, assertion) CMC_ASSERT_GLUE_(dtype, assertion)
      |                                           ^~~~~~~~~~~~~~~~
../cmc/utl/assert.h:136:5: note: in expansion of macro ‘CMC_ASSERT_GLUE’
  136 |     CMC_ASSERT_GLUE(dtype, equals) \
      |     ^~~~~~~~~~~~~~~
./unt_deque.h:1180:9: note: in expansion of macro ‘cmc_assert_equals’
 1180 |         cmc_assert_equals(bool, true, it.start);
      |         ^~~~~~~~~~~~~~~~~

Time variable                                  wall           GGC
 phase setup                        :   0.00 (  0%)  1914k (  1%)
 phase parsing                      :   0.45 ( 10%)    66M ( 22%)
 phase opt and generate             :   3.84 ( 89%)   238M ( 77%)
 phase last asm                     :   0.02 (  1%)   727k (  0%)
 callgraph construction             :   0.07 (  2%)    14M (  5%)
 callgraph optimization             :   0.06 (  1%)  1821k (  1%)
 callgraph ipa passes               :   0.95 ( 22%)    45M ( 15%)
 ipa inlining heuristics            :   0.01 (  0%)     0  (  0%)
 ipa profile                        :   0.59 ( 14%)    17M (  6%)
 cfg cleanup                        :   0.02 (  0%)  7752  (  0%)
 trivially dead code                :   0.04 (  1%)     0  (  0%)
 df scan insns                      :   0.12 (  3%)    34k (  0%)
 df live regs                       :   0.05 (  1%)     0  (  0%)
 df reg dead/unused notes           :   0.07 (  2%)  4914k (  2%)
 register information               :   0.02 (  1%)     0  (  0%)
 alias analysis                     :   0.03 (  1%)  1439k (  0%)
 alias stmt walking                 :   0.05 (  1%)  2000  (  0%)
 rebuild jump labels                :   0.03 (  1%)     0  (  0%)
 preprocessing                      :   0.13 (  3%)    34M ( 11%)
 lexical analysis                   :   0.04 (  1%)     0  (  0%)
 parser (global)                    :   0.01 (  0%)  2577k (  1%)
 parser function body               :   0.27 (  6%)    28M (  9%)
 inline parameters                  :   0.03 (  1%)   881k (  0%)
 tree gimplify                      :   0.11 (  2%)    21M (  7%)
 tree eh                            :   0.01 (  0%)    53k (  0%)
 tree CFG construction              :   0.06 (  1%)    21M (  7%)
 tree CFG cleanup                   :   0.03 (  1%)   400  (  0%)
 tree SSA rewrite                   :   0.03 (  1%)  6684k (  2%)
 tree SSA incremental               :   0.02 (  0%)  1893k (  1%)
 tree operand scan                  :   0.03 (  1%)    10M (  3%)
 tree RPO VN                        :   0.06 (  1%)  2061k (  1%)
 dominance computation              :   0.03 (  1%)     0  (  0%)
 out of ssa                         :   0.03 (  1%)   384k (  0%)
 expand vars                        :   0.04 (  1%)  8015k (  3%)
 expand                             :   0.30 (  7%)    53M ( 17%)
 post expand cleanups               :   0.02 (  0%)   519k (  0%)
 loop init                          :   0.01 (  0%)  1637k (  1%)
 integrated RA                      :   0.80 ( 19%)    43M ( 14%)
 LRA non-specific                   :   0.35 (  8%)   157k (  0%)
 LRA virtuals elimination           :   0.05 (  1%)  3830k (  1%)
 LRA reload inheritance             :   0.03 (  1%)     0  (  0%)
 LRA create live ranges             :   0.05 (  1%)    11k (  0%)
 LRA hard reg assignment            :   0.01 (  0%)     0  (  0%)
 thread pro- & epilogue             :   0.04 (  1%)  1175k (  0%)
 shorten branches                   :   0.11 (  2%)     0  (  0%)
 final                              :   0.23 (  5%)  5343k (  2%)
 symout                             :   0.05 (  1%)    13M (  4%)
 uninit var analysis                :   0.01 (  0%)  3400  (  0%)
 access analysis                    :   0.03 (  1%)  4488  (  0%)
 rest of compilation                :   0.15 (  3%)  3201k (  1%)
 TOTAL                              :   4.32          308M
/usr/bin/ld: /tmp/ccrlTrrR.o: in function `CMCDequeIter':
/home/yinghao/dev/C-Macro-Collections/tests/./unt_deque.h:1169:(.text+0x2710e): undefined reference to `cmc_assert_equals_bool'
/usr/bin/ld: /home/yinghao/dev/C-Macro-Collections/tests/./unt_deque.h:1169:(.text+0x2713b): undefined reference to `cmc_assert_equals_bool'
/usr/bin/ld: /home/yinghao/dev/C-Macro-Collections/tests/./unt_deque.h:1169:(.text+0x27573): undefined reference to `cmc_assert_equals_bool'
/usr/bin/ld: /home/yinghao/dev/C-Macro-Collections/tests/./unt_deque.h:1169:(.text+0x27b0b): undefined reference to `cmc_assert_equals_bool'
/usr/bin/ld: /home/yinghao/dev/C-Macro-Collections/tests/./unt_deque.h:1169:(.text+0x27b38): undefined reference to `cmc_assert_equals_bool'
/usr/bin/ld: /tmp/ccrlTrrR.o:/home/yinghao/dev/C-Macro-Collections/tests/./unt_deque.h:1169: more undefined references to `cmc_assert_equals_bool' follow
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:8: main] Error 1
make[1]: Leaving directory '/home/yinghao/dev/C-Macro-Collections/tests'
make: *** [Makefile:14: tests] Error 2

Please complete the following information:

  • Type: tests
  • OS: Fedora Linux 42
  • Compiler: gcc
  • Compiler Version: 15.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions