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.

AM3358: Find reason for a warning within a macro

Part Number: AM3358

I'm building my AM3358-stuff with the TI ARM compiler. At some point in code I get a

warning #193-D: type qualifier is meaningless on cast type

The position in code that causes this warning is a macro

COMMON_MTYPE_CASES

Unfortunately this macro is quite big, so there is no obvious reason for this warning.

My question: is there a possibility to let the compiler be more specific regarding the exact position of the reason for this warning? I already enabled the option --gen_preprocessor_listing to let the compiler generate .rl-files which contain the whole, preprocessed code (so that COMMON_MTYPE_CASES is recolved), but that does not help very much, the compiler / compiler output still uses the code line out of the .c-file, not out of the -rl-file for issuing the warning.

Thanks!

  • Here is a method to consider.  It uses a combination of verbose diagnostics and preprocessing.  It is demonstrated on a contrived example.  

    These two commands show the source file, and an initial build of it.

    C:\working_directory>type file.c
    /* Illegal operator in C */
    #define MACRO 10 ** 5
    int var = MACRO;
    
    C:\working_directory>armcl file.c
    "file.c", line 3: error: operand of "*" must be a pointer

    Whenever a diagnostic is confusing, use the option --verbose_diagnostics to see more about it ...

    C:\working_directory>armcl --verbose_diagnostics file.c
    "file.c", line 3: error: operand of "*" must be a pointer
      int var = MACRO;
                ^

    In this particular case, it does not help.  

    Next preprocess the file.  Use the option --preproc_with_comment.

    C:\working_directory>armcl --preproc_with_comment file.c

    The preprocessed file has the same name as the source file, with the file extension changed to .pp.

    C:\working_directory>type file.pp
    /* Illegal operator in C */
    int var = 10 * * 5;

    Next, build the preprocessed file with --verbose_diagnostics ...

    C:\working_directory>armcl --verbose_diagnostics file.pp
    "file.pp", line 2: error: operand of "*" must be a pointer
      int var = 10 * * 5;
                       ^

    That usually makes the problem easy to understand.

    For more details on the compiler options used, please search for them in the TI ARM compiler manual.

    Thanks and regards,

    -George