Warnings with Wall and Wextra

Sysprogs forums Forums VisualGDB Warnings with Wall and Wextra

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #36266
    wtywtykk
    Participant

    Hi,

    When I compile with -Wall and -Wextra, I get some warnings:

    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32\STM32L4xxxx\StartupFiles\startup_stm32l432xx.c(579,5): warning : 'MemManage_Handler' specifies less restrictive attribute than its target 'Default_Handler': 'noreturn'
    1> 580 | void MemManage_Handler() __attribute__ ((weak, alias ("Default_Handler")));
    1> | ^~~~~~~~~~~~~~~~~
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32\STM32L4xxxx\StartupFiles\startup_stm32l432xx.c(780,39): note : 'MemManage_Handler' target declared here
    1> 780 | void __attribute__((naked, noreturn)) Default_Handler()
    1> | ^~~~~~~~~~~~~~~
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32\STM32L4xxxx\StartupFiles\startup_stm32l432xx.c(578,5): warning : 'HardFault_Handler' specifies less restrictive attribute than its target 'Default_Handler': 'noreturn'
    1> 579 | void HardFault_Handler() __attribute__ ((weak, alias ("Default_Handler")));
    1> | ^~~~~~~~~~~~~~~~~
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32\STM32L4xxxx\StartupFiles\startup_stm32l432xx.c(780,39): note : 'HardFault_Handler' target declared here
    1> 780 | void __attribute__((naked, noreturn)) Default_Handler()
    1> | ^~~~~~~~~~~~~~~

     

    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler\InstrumentingProfiler.cpp(128): note : included from here
    1>C:/Users/wty/AppData/Local/VisualGDB/EmbeddedEFPs/Profiler/SmallNumberCoder.h: In static member function 'static int SysprogsInstrumentingProfiler::SmallNumberCoder::IsSignedIntConstrained(int, int)':
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler\SmallNumberCoder.h(14,30): warning : left shift of negative value
    1> 15 | int mask = -1 << bits;
    1> | ~~~^~~~~~~
    1>C:/Users/wty/AppData/Local/VisualGDB/EmbeddedEFPs/Profiler/SmallNumberCoder.h: In static member function 'static int SysprogsInstrumentingProfiler::SmallNumberCoder::IsUnsignedIntConstrained(unsigned int, int)':
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler\SmallNumberCoder.h(21,30): warning : left shift of negative value
    1> 22 | int mask = -1 << bits;
    1> | ~~~^~~~~~~
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler\InstrumentingProfiler.cpp(0): note : In function 'void SysprogsInstrumentingProfiler::SysprogsInstrumentingProfilerReturnHookImpl(void**)'
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler\InstrumentingProfiler.cpp(435,77): warning : unused variable 'holder'
    1> 436 | VendorSpecificWorkarounds::VendorSpecificInterruptHolderRAII holder;
    1> | ^~~~~~
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler\InstrumentingProfiler.cpp(0): note : In function 'void SysprogsInstrumentingProfiler::SysprogsInstrumentingProfilerHookImpl(void**)'
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler\InstrumentingProfiler.cpp(481,77): warning : unused variable 'holder'
    1> 482 | VendorSpecificWorkarounds::VendorSpecificInterruptHolderRAII holder;
    1> | ^~~~~~
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler\TestResourceManager.cpp(0): note : In function 'int _read(int, char*, int)'
    1>C:\Users\wty\AppData\Local\VisualGDB\EmbeddedEFPs\Profiler\TestResourceManager.cpp(299,25): warning : unused parameter 'fd'
    1> 300 | extern "C" int _read(int fd, char *pBuffer, int size)
    1> | ~~~~^~

     

    I’m able to fix them either by modifing the files directly or by tweaking warning level for invdidual files. But it would be nice if you can fix them on your side.

    Also is it possible to add something like “Dedicated warning and optimization level for BSP files”? Because somttimes there are warnings in BSP provided by chip manufacturers. And for some small devices we need to change optimization level for BSP files to fit all code into Flash in debug mode.

     

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.