Re: PREfast: Different outcome if compiled with or without?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ray Trent (ratrent_at_nospam.nospam)
Date: 02/18/05


Date: Fri, 18 Feb 2005 13:35:34 -0800

What's the error message?

Spiro Trikaliotis wrote:
> Hello,
>
> I just had a somehow unexpected result: I compiled a driver which
> compiles perfectly ("build -cZ") with PREfast (driver specific rules),
> that is, "prefast build -cZ".
>
> Somehow, the compilation breaks if I use prefast. I tracked it down to
> the following statement:
>
> signal(SIGINT, reset);
>
> Somewhere else, there is the following function definition:
>
> static void ARCH_SIGNALDECL reset(int dummy)
> { ... }
>
> and, in some header file, there is:
>
> #ifdef WIN32
> #define ARCH_LINUX_WINDOWS( _linux, _windows) _windows
> #else
> #define ARCH_LINUX_WINDOWS( _linux, _windows) _linux
> #endif
> #define ARCH_SIGNALDECL ARCH_LINUX_WINDOWS(/* no decl needed */, __cdecl)
>
>
> Yes, I AM sure that this header file is included before. ARCH_SIGNALDECL
> is not defined anywhere else, but the compiler does not complain about
> ARCH_SIGNALDECL not defined, but about not being able to convert reset()
> from __stdcall to __cdecl.
>
> Now, if I replace
>
> static void ARCH_SIGNALDECL reset(int dummy)
> { ... }
>
> through
>
> static void __cdecl reset(int dummy)
> { ... }
>
> everything works fine.
>
>
> Well, the most interesting part is: If I do NOT use prefast, even the
> first version works perfectly. It works perfectly, too, if I replace
>
> #define ARCH_SIGNALDECL ARCH_LINUX_WINDOWS(__cdecl, __cdecl)
>
> Now, I ask myself what changes PREfast does to the compiler?
>
> I do not understand why this compiles perfectly without PREfast, but
> does not compile with PREfast.
>
> Ah, I forgot: This happens with PREfast 1.5.2402 (2K3 SP1 RC1 DDK,
> 3790.1289), as well as with 2K3 DDK (3790) - in the latter case,
> obviously without the driver specific rules.
>
> Can anybody give me a good hint on what is going on?
>
> Regards,
> Spiro.
>

-- 
../ray\..


Relevant Pages

  • Re: PREfast and #include <cstdio> and such
    ... Prefast seems to use a modified version of the C++ compiler, ... > (converted to a makefile project for this purpose...pheow!), ... > sipchannel.cpp: warning 98102: Error Processing File ...
    (microsoft.public.development.device.drivers)
  • lucent modem driver compilation failure
    ... I'm trying to compile an installable module for my internal modem ... and driver work as they were fully functional under RH7.3. ... 00:07.2 USB Controller: VIA Technologies, ... If not present use the ltmodem-8.22a5.tar.gz compiler kit. ...
    (linux.redhat.misc)
  • lucent modem driver compilation failure
    ... I'm trying to compile an installable module for my internal modem ... and driver work as they were fully functional under RH7.3. ... 00:07.2 USB Controller: VIA Technologies, ... If not present use the ltmodem-8.22a5.tar.gz compiler kit. ...
    (comp.os.linux.hardware)
  • Re: [PATCH 2/2] x86 platform driver: intelligent power sharing driver
    ... I bet the driver blows up and someone's logs get spammed;) ... Somehow the compiler will promote array ... Ah ok, will fix. ... don't trash callee's error code - propagate it. ...
    (Linux-Kernel)
  • Re: I am learning C: a little problem with a simple source code
    ... One can turn off particular warnings with this compiler, ... For each driver, if the size is unsupported, the driver can give up. ... Similarly, it'd be nice to pass a 'size_t' for the alignment, too. ...
    (comp.lang.c)