Thomas Matthews
Thomas Matthews

Reputation: 57728

IAR Embedded Workbench "va_list_ is undefined

I'm using Coverity Analysis on an IAR Embedded Workbench project.

When I use the IAR Embedded Workbench IDE to build, there are zero errors and zero warnings. When I use a batch file (Windows command window), there are zero errors and zero warnings:

    "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.4\common\bin\IarBuild.exe" .\EWARM\Voyant3.ewp -build Voyant3

When I have Coverity use IAR EW command line, I'm getting the error:
 "c:\program files (x86)\iar systems\embedded workbench 8.4\arm\inc\c\yvals.h",
           line 321: error #20: identifier "va_list" is undefined
     typedef _VA_LIST __Va_list;
             ^
 
 Emit for file 'C:/sandboxes/git/voyant-3/Voyant3/Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src/usbh_msc_scsi.c' complete.  
 [ERROR] 1 error detected in the compilation of "Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src/usbh_msc_scsi.c".
 WARNING: cov-emit returned with code 1

Here are my questions:

  1. Where is va_list defined?
  2. How do I tell Coverity to define it?
  3. Is there something else that I missing?

I'm using: IAR EW: 8.42
Coverity: 2019

Edit 1: Coverity configuration command
Here's the command I use to configure Coverity with IAR:

"C:\Program Files\Coverity\Coverity Static Analysis\bin" ^
-co "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.4\arm\bin\iccarm.exe" ^
--xml-option=add_arg:"--unsigned_chars" ^
--xml-option=add_arg:"--enable_user_sections" ^
--xml-option=add_arg:"--ppp_translator" ^
--xml-option=add_arg:"replace/\bchar\b/unsigned char" ^
--xml-option=add_arg:"--ppp_translator" ^
--xml-option=add_arg:"replace/signed\s+unsigned\s+char/signed char" ^
-- -e --endian=little --cpu="ST STM32H743ZI" ^
--dlib_config "c:\Program Files (x86)\IAR Systems\Embedded Workbench 8.4\arm\inc\c\DLib_Config_Full.h"

Upvotes: 0

Views: 797

Answers (1)

Scott McPeak
Scott McPeak

Reputation: 12789

Answers to numbered questions:

  1. va_list is normally defined via #include <stdarg.h>.

  2. You should not have to tell Coverity about it. Coverity is supposed to take care of low-level compiler compatibility automatically. It's sometimes possible to kludge together a solution using ppp_translator but I don't know enough to suggest such a workaround for this case.

  3. IAR 8.42 was released on 2019-12-19. IAR 8.40 was released on 2019-05-27. Coverity compiler support usually lags at least 6 months behind the releases of the compilers themselves, and it can easily be longer than that. I think the most likely explanation is the Coverity 2019 release does not contain support for IAR 8.4, which introduced some significant changes around how varargs work.

If my speculation is right, you'll either need to get a later version of Coverity and check its release notes to see if it has IAR 8.4 support, or else use an older version of IAR, one supported by Coverity 2019. Again, check its release notes (which don't seem to be publicly available) to see which versions it supports.

Upvotes: 0

Related Questions