[PATCH] Support for #pragma detect_mismatch

Aaron Ballman aaron at aaronballman.com
Tue May 28 11:53:50 PDT 2013


Ping?

~Aaron

On Fri, May 24, 2013 at 4:27 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> This patch adds support for MSVC's #pragma detect_mismatch.  This
> pragma emits a linker command into the object file which allows the
> linker to ensure that there are no inconsistent object files being
> linked together.  Eg)
>
> // 1.cpp
> #pragma detect_mismatch( "my_library", "1" )
>
> // 2.cpp
> #pragma detect_mismatch( "my_library", "2" )
>
> If you link these files together with link.exe, you will get a linker
> error (2038) pointing out that the values for my_library do not match.
>  However, if 2.cpp had "1" in place of "2", the files would link
> together without issue.
>
> For more information, see MSDN:
> http://msdn.microsoft.com/en-us/library/ee956429.aspx
>
> The code was modeled after our existing support for passing linker
> commands, and makes use of the fact that detect_mismatch uses the
> /FAILIFMISMATCH linker option.
>
> ~Aaron



More information about the cfe-commits mailing list