This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ARM-CGT-CLANG -1 v1.3.1.LTS warning flag options (AWR2944)

Hello (on behalf of a customer),

I have some question about TI clang compiler flags, 

 

In our SW TI Clang compiler flag  “-Werror” is used.

 

“-Werror”  : Treat detected warning as error.

 

I removed “-Werror” and added “-Weverything” in compiler option , Now I can see list of compiler warnings in SW build logs.

 

Could you provide me list of SW warning detected by “-Werror” flag?

 

Which option will you suggest for compiler warning be used in production program, so we should  not missed any important warning fix in SW.

We are using: 

Compiler version- ARM-CGT-CLANG -1 v1.3.1.LTS

Thanks, Stefan

  • Which option will you suggest for compiler warning be used in production program

    There is not one single answer, which is why the compiler provides different options.  

    Could you provide me list of SW warning detected by “-Werror” flag?

    These details are not documented, which is why I filed the entry EXT_EP-10855.  Feel free to follow it with that link.  In the meantime, use the documentation on this page.  We have not tested every option on this page.  But many of them do work as described.

    Thanks and regards,

    -George

  • Flag "-Weverthing" list out all the warning.

    When both flag Werror" and "Weverything" then code build will fail.

    If i keep "Werror" flag alone , then build will pass, this i am not understanding why "Werror" is not able to detect warning as error

  • For one source file where this occurs ...

    When both flag Werror" and "Weverything" then code build will fail.

    If i keep "Werror" flag alone , then build will pass

    ... please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Hi Team,

    Attaching relevant files showing the issue.

    we tried 3 compiler options , attached are the .c file , .ti_compiler_flags.bzl and command.txt file that show how our build behave with each of those options.

    Wunused , Weverything , Werror and Weverything

    Werror Weverything : this crashes our build for every warning

    Wunused : build goes thru only listing warnings in the category of Wunused

    Weverything : Build crashes for warnings

    we also tried Werror alone where the build just goes through without listing any warnings.

    Our requirement now is to come up with proper/valid compiler option so that we not miss production relevant warnings in our production SW.

  • Thank you for submitting the source files and build logs.  Unfortunately, I remain unable to reproduce this behavior ...

    Werror Weverything : this crashes our build for every warning

    I am unable to use any of the source files supplied, because they all #include many files, and I do not have these files.  That is why the article https://software-dl.ti.com/ccs/esd/documents/sdto_cgt_How-to-Submit-a-Compiler-Test-Case.html shows how to preprocess the files.  Once preprocessing is complete, there is only one file to submit.  Please focus on the part of the article titled Makefile Method and Clang Compiler.  Use those directions only as a general guide.  Adapt them to the details of how your build works.

    Thanks and regards,

    -George

  • Hello Team,

    Attaching preprocessed files in addition, in reference with KrishnaMeghana's query.

    Please check the above said query for more details.

  • Thank you for submitting a test case.

    When you said ...

    When both flag Werror" and "Weverything" then code build will fail.

    ... I took that to mean the compiler itself had a catastrophic failure.  I never reproduced that result.  I did see this ...

    tiarmclang @options.txt -Weverything -Werror -c file.c
    <many diagnostics omitted>
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.

    (The file options.txt has all of your build options, except for the three you see.  file.c is your preprocessed file, copied into a normal C source file).  When 20 errors are seen, this last diagnostic is issued, and compilation halts.  I presume this is what you see.  To overcome it, set -ferror-limit to a high number.  Then compilation completes ...

    tiarmclang @options.txt -Weverything -Werror -c -ferror-limit=100 file.c
    <many diagnostics omitted>
    54 errors generated.

    As far as I can tell, all 54 diagnostics are legitimate.  The very first one ...

    In file included from software/app/mss/src/mss_main.c:38:
    In file included from bazel-out/ti_arm-fastbuild/bin/software/app/mss/mcal/wrappers/adc/_virtual_includes/dd_adc_h\dd_adc.h:32:
    bazel-out/ti_arm-fastbuild/bin/software/app/mss/mcal/Workspace/AWR294x/_virtual_includes/Adc_Cfg_h\Adc_Cfg.h:812:12: error:
          padding struct 'Adc_ChannelConfigType' with 1 byte to align 'channelConfigValue' [-Werror,-Wpadded]
        uint32 channelConfigValue;
               ^

    ... says that in this structure ...

    typedef struct
    {
        Adc_ChannelType hwChannelId;
    # 800 "bazel-out/ti_arm-fastbuild/bin/software/app/mss/mcal/Workspace/AWR294x/_virtual_includes/Adc_Cfg_h\\Adc_Cfg.h"
        uint8 settlingTime;
    
    
    
        boolean isConfigured;
    
    
    
    
    
    
    
        uint32 channelConfigValue;

    ... the compiler inserts a byte of padding just before the field channelConfigValue.  That is accurate.  A requirement of C is that the fields of a structure are laid out in the same order as in the source code.  A 32-bit wide field must be aligned to a 4-byte boundary.  The total size of all the fields before channelConfigValue is 3 bytes.  Thus, 1 byte of padding is required.  By default, this diagnostic is not emitted.  Adding -Weverything causes this diagnostic to be emitted as a warning.  Adding -Werror causes it to be emitted as an error.  The situation with all the other diagnostics is similar.

    Getting a successful build while using both -Weverything -Werror is possible, but difficult.  Is it worth all the trouble?  Only you can decide.

    Thanks and regards,

    -George