Jump to content

Warnings of SystemC with pedantic CMake


Hadrian2002

Recommended Posts

Hi,

I have 2 suggestions for the current SystemC reference implementation. I started to use pandantic compiling option for my project and this throws many warnings in SystemC headers. Altough it's annoying but there many simple fixes for unused variables. For base classes where you don't use the proposed parameter like here (one random example)

../systemc-lib/src/tlm_core/tlm_2/tlm_generic_payload/tlm_gp.h:349:57: warning: unused parameter 'ext' [-Wunused-parameter]
template <typename T> void clear_extension(const T* ext)

you can simply switch to this one

template <typename T> void clear_extension(const T* /*ext*/)

If you want I can do a pushRequest for this on github.

 

But maybe you are not interested in this, than you could at least make it easy for users of CMake to not print them, if they compile their code. The simplest approach for this is to change the CMakelists.txt in src from

...
target_include_directories(systemc
  PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
....

to

target_include_directories(systemc
  PRIVATE
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
  PUBLIC INTERFACE
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

kind regards

 

Link to comment
Share on other sites

Interesting, I'm not an expert in CMake, but even with existing CMakeLists.txt when I build my application SystemC include directory is recognized automatically as system headers:

Quote

/usr/bin/clang++   -isystem /home/ripopov/distrib/systemc/include  -Wall -Wpedantic -g   -pthread -std=gnu++11 -o CMakeFiles/test_systemc.dir/main.cpp.o -c /home/ripopov/work/personal/test_systemc/main.cpp

And as a result I don't receive any warnings about issues in SystemC headers.

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...