CMock: gcc -Wno-pragmas doesn't work

I keep getting warnings about using #pragma once in header files, like below:

Test 'test_util_double_buffer.c'
--------------------------------
src/util/util_assert.h:1:9: warning: #pragma once in main file
 #pragma once
         ^~~~
Compiling test_util_double_buffer_runner.c...

I can’t figure out how to turn them off. Theoretically I should be able to pass -Wno-pragmas (for gcc) or -Wno-pragmas-outside-main (for clang) but neither option seems to shut it up. Is there something I am missing?

I pass the arguments as follows (in my ceedling project.yml file), but it doesn’t remove the warnings

:flags:
  :test:
    :compile:
        :*:
            - -Wno-int-to-pointer-cast
            - -Wno-pointer-to-int-cast
            - -Wno-pragmas

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

@mvandervoord okay that makes sense. I can’t disable preprocessing, since I have a ton of #ifdefs and stuff. How can I provide -wno-pragmas to the preprocessor? I can’t find any answers in the docs – it doesn’t appear that there is a preprocessor option in :flags: :test:, and passing it as a test compiler flag does’t get rid of the warning

The following are all the flag options in the docs:

flags: configure per-file compilation and linking flags

Ceedling tools (see later [:tools] section) are used to configure compilation and linking of test and source files. These tool configurations are a one-size-fits-all approach. Should individual files require special compilation or linking flags, the settings in the [:flags] section work in conjunction with tool definitions by way of argument substitution to achieve this.

    release:

    [:compile] or [:link] flags for release build

    test:

    [:compile] or [:link] flags for test build