How to remove some compilation warnings caused by calling pdl in modus toolbox

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JCD
Level 3
Level 3
50 sign-ins 25 sign-ins 10 replies posted

Hello,

        1.Warnings as follow:        

        ../CODE/libs/mtb-pdl-cat1/latest-v2.X/cmsis/include/core_cm4.h:1775:22: warning: '__NVIC_ClearPendingIRQ' defined but not used [-Wunused-function]

        2.Problem description:

        After the first compilation of the project, there will be more than 30,000 warning messages as shown above, and after the second compilation, the warning messages will become 0. Looking at the file where the problem is located, you will find that it is all caused by quoting the pdl library in the libs file, but there is no problem with the pdl library.

        3.Question:

        How to remove these warning messages that should not be displayed, and not ignore the real error and warning .

        4.My own guess:

        It may be caused by the wrong way or path of calling the pdl library, but the problem has not been solved. 

        In summary, I have been troubled by this problem for a long time. If you can help me solve this problem, I would be very grateful. 

Best Wishes,

JCD        

0 Likes
1 Solution
JCD
Level 3
Level 3
50 sign-ins 25 sign-ins 10 replies posted

Hello moto,

        I just tried it, 

-Wunused-function

        This command does not work, which means to warn about unused function.

-Wno-unused-function

        This command works, I think it means that unused function do not warn.

Best Wishes,

JCD       

View solution in original post

7 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I think that the answer is in the warning message  [-Wunused-function],

if you add "-Wunused-function" in the compiler option, the warning will not be displayed.

moto

 

0 Likes
JCD
Level 3
Level 3
50 sign-ins 25 sign-ins 10 replies posted

Hello moto,

        Thanks for your help!

        But I have tow questions:

        1.Can you tell me the specific setting method? 

        2.Will it affect the normal warning message? For example, if I add a variable myself but haven't used it, will I still report a warning? 

Best Wishes,

JCD        

 

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I just tried with MTB's sample project "Hello World" and I added a dummy function, which has content,

but is not called. But during the build, I could not locate "unused function" warning...

 

Anyway, as MTB uses Makefile, I would add "-Wunused-function" in the following part in the "Makefile"

# Additional / custom C compiler flags.
#
# NOTE: Includes and defines should use the INCLUDES and DEFINES variable
# above.
CFLAGS= -Wunused-function

Note: I'm sorry but I can not confirm if this works with my current condition.

 

(2) I think that it will also mask "unused function" warning of your part, too.

Warning flags for "unused function" and "unused variable" may be different though.

As you observed, the warnings for the library part, will not be generated again once they are compiled,

unless/until you change the source(s) in the "library".

So may be, it's safe not to mask warning and put up with the first time flood of warning messages.

 

moto

 

0 Likes
JCD
Level 3
Level 3
50 sign-ins 25 sign-ins 10 replies posted

Hello moto,

        Thanks for your help.

        But I think the following command should be used

-Wno-unused-function

        What do you think ?

Best Wishes,

JCD        

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi, JCD-san,

May be that's right, would you test both and teach me the result?

Best Regards,

moto

0 Likes
JCD
Level 3
Level 3
50 sign-ins 25 sign-ins 10 replies posted

Hello moto,

        I just tried it, 

-Wunused-function

        This command does not work, which means to warn about unused function.

-Wno-unused-function

        This command works, I think it means that unused function do not warn.

Best Wishes,

JCD       

MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear JCD-san,

   I just tried it, 
        This command works, I think it means that unused function do not warn.
Thank you ! 😉

Best Regards,

moto

0 Likes