From shelleyd at kdsolutionsgroup.com Wed Sep 28 10:29:58 2011 From: shelleyd at kdsolutionsgroup.com (Shelley Dong) Date: Wed, 28 Sep 2011 10:29:58 -0700 Subject: [splint-discuss] A preprocessing error when run Splint on RTW generated code Message-ID: <2F6468CE4F975A4AA94EF1A4EDAFBECCBB577A18E8@KDS-MAIL-2009.Silvatechfluidpower.com> Hello there, We are currently using Splint to do static analysis on the code generated by RTW from Simulink models. There are some preprocessing code auto generated to error out the compiling process when certain conditions are true, usually boundary checks. Splint was not able to preprocess and produce errors. I attached one of them below. We are wondering if anybody else ever reported similar issues and if Splint works fine with auto generated code. Thanks for your answer. - Shelley C:\...\ HVCM_private.h (35, 440): #error "Code was generated for compiler with different sized ushort/short. Consider adjusting Emulation Hardware word size settings on the Hardware Implementation pane to match your compiler word sizes as defined in the compilers limits.h header file. Alternatively, you can select 'None' for Emulation Hardware and select the 'Enable portable word sizes' option for ERT based targets, this will disable the preprocessor word size checks." Preprocessing error. (Use -preproc to inhibit warning) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20110928/88c4939d/attachment-0001.html From lholzheid at bihl-wiedemann.de Wed Sep 28 11:06:55 2011 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Wed, 28 Sep 2011 20:06:55 +0200 Subject: [splint-discuss] A preprocessing error when run Splint on RTW generated code In-Reply-To: <2F6468CE4F975A4AA94EF1A4EDAFBECCBB577A18E8@KDS-MAIL-2009.Silvatechfluidpower.com> References: <2F6468CE4F975A4AA94EF1A4EDAFBECCBB577A18E8@KDS-MAIL-2009.Silvatechfluidpower.com> Message-ID: <20110928180655.GC15076@shadow.bihl-wiedemann.de> On Wed, 2011-09-28 10:29:58 -0700, Shelley Dong wrote: > Hello there, > > We are currently using Splint to do static analysis on the code generated by RTW from Simulink models. There are some preprocessing code auto generated to error out the compiling process when certain conditions are true, usually boundary checks. Splint was not able to preprocess and produce errors. I attached one of them below. We are wondering if anybody else ever reported similar issues and if Splint works fine with auto generated code. Thanks for your answer. - Shelley > > C:\...\ HVCM_private.h (35, > 440): #error "Code was generated for compiler with different sized > ushort/short. Consider adjusting Emulation Hardware word size settings on > the Hardware Implementation pane to match your compiler word sizes as > defined in the compilers limits.h header file. Alternatively, you can > select 'None' for Emulation Hardware and select the 'Enable portable word > sizes' option for ERT based targets, this will disable the preprocessor > word size checks." > Preprocessing error. (Use -preproc to inhibit warning) Shelley, This has nothing to do with the code being auto-generated or not. Splint hits an #error directive in your code, probably due to running with a different set of (pre-) defined symbols than your compiler. You'll have to look at line 35 of HVCM_private.h to figure out what's going wrong and to determine a set of symbols that makes splint take the same code paths than your compiler. HTH, Ludolf -- --------------------------------------------------------------- Ludolf Holzheid Tel: +49 621 339960 Bihl+Wiedemann GmbH Fax: +49 621 3392239 Flo?w?rthstra?e 41 e-mail: lholzheid at bihl-wiedemann.de D-68199 Mannheim, Germany --------------------------------------------------------------- From ok at cs.otago.ac.nz Wed Sep 28 15:57:20 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Thu, 29 Sep 2011 11:57:20 +1300 Subject: [splint-discuss] A preprocessing error when run Splint on RTW generated code In-Reply-To: <2F6468CE4F975A4AA94EF1A4EDAFBECCBB577A18E8@KDS-MAIL-2009.Silvatechfluidpower.com> References: <2F6468CE4F975A4AA94EF1A4EDAFBECCBB577A18E8@KDS-MAIL-2009.Silvatechfluidpower.com> Message-ID: <31E9C31F-3004-4770-B15F-EF6845D4A3BD@cs.otago.ac.nz> On 29/09/2011, at 6:29 AM, Shelley Dong wrote: > C:\...\ HVCM_private.h (35, > 440): #error "Code was generated for compiler with different sized > ushort/short. Consider adjusting Emulation Hardware word size settings on > the Hardware Implementation pane to match your compiler word sizes as > defined in the compilers limits.h header file. Alternatively, you can > select 'None' for Emulation Hardware and select the 'Enable portable word > sizes' option for ERT based targets, this will disable the preprocessor > word size checks." This seems remarkably clear. The program that generated the C code made certain assumptions about sizeof (short) and sizeof (unsigned short). Splint makes other assumptions. HVCM_private.h has noted the discrepancy. Do what the error message says: change the parameters in the Hardware Implementation pane and regenerate, or do the Enable portable word sizes thing. From ok at cs.otago.ac.nz Wed Sep 28 15:57:20 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Thu, 29 Sep 2011 11:57:20 +1300 Subject: [splint-discuss] A preprocessing error when run Splint on RTW generated code In-Reply-To: <2F6468CE4F975A4AA94EF1A4EDAFBECCBB577A18E8@KDS-MAIL-2009.Silvatechfluidpower.com> References: <2F6468CE4F975A4AA94EF1A4EDAFBECCBB577A18E8@KDS-MAIL-2009.Silvatechfluidpower.com> Message-ID: <31E9C31F-3004-4770-B15F-EF6845D4A3BD@cs.otago.ac.nz> On 29/09/2011, at 6:29 AM, Shelley Dong wrote: > C:\...\ HVCM_private.h (35, > 440): #error "Code was generated for compiler with different sized > ushort/short. Consider adjusting Emulation Hardware word size settings on > the Hardware Implementation pane to match your compiler word sizes as > defined in the compilers limits.h header file. Alternatively, you can > select 'None' for Emulation Hardware and select the 'Enable portable word > sizes' option for ERT based targets, this will disable the preprocessor > word size checks." This seems remarkably clear. The program that generated the C code made certain assumptions about sizeof (short) and sizeof (unsigned short). Splint makes other assumptions. HVCM_private.h has noted the discrepancy. Do what the error message says: change the parameters in the Hardware Implementation pane and regenerate, or do the Enable portable word sizes thing.