Saikat Posted May 24, 2021 Report Posted May 24, 2021 Hi, I am new to SystemC programming. I started implementing from scratch. My intention is to develop TLM models depicting different processor subsystems. I have two questions regarding compilation. 1. Can we use gcc or we should use g++ only? 2. I want to enable all the possible warnings for debug purposes. I am using the following switches. I will appreciate if you please comment regarding the switches. -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused Thanks in advance. Best regards SC Quote
AmeyaVS Posted May 25, 2021 Report Posted May 25, 2021 Hello @Saikat, Regarding your questions. 6 hours ago, Saikat said: 1. Can we use gcc or we should use g++ only? Since SystemC is written in C++, g++ should be the default. 6 hours ago, Saikat said: 2. I want to enable all the possible warnings for debug purposes. I am using the following switches. I will appreciate if you please comment regarding the switches. Regarding compiler warning the ones mentioned in your post: 6 hours ago, Saikat said: -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused Seems a good enough list for now. I would prefer you going through your compiler manual to figure which ones you might need. But, as my personal preference I usually prefer to build my code with various compilers and on various platforms to get the best possible platforms compatible code. It is very easy the write a code which might end up being platform/compiler dependent. Better to stick with standard C++ language compliance to get the most out of your code. Regards, Ameya Vikram Singh Saikat 1 Quote
Saikat Posted May 25, 2021 Author Report Posted May 25, 2021 6 hours ago, AmeyaVS said: Hello @Saikat, Regarding your questions. Since SystemC is written in C++, g++ should be the default. Regarding compiler warning the ones mentioned in your post: Seems a good enough list for now. I would prefer you going through your compiler manual to figure which ones you might need. But, as my personal preference I usually prefer to build my code with various compilers and on various platforms to get the best possible platforms compatible code. It is very easy the write a code which might end up being platform/compiler dependent. Better to stick with standard C++ language compliance to get the most out of your code. Regards, Ameya Vikram Singh Thanks Ameya!! Being from a very different background it helps really as of now. Quote
maehne Posted May 25, 2021 Report Posted May 25, 2021 Be aware that SystemC itself is compiled with g++/clang++ using the following options "-Wall -Wextra -no-unused-parameter -W-no-unused-variable". Any additional warning options might trigger additional warnings inside the SystemC headers. You may therefore point g++ to the headers using "-isystem" instead of "-I". Quote
Recommended Posts
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.