configure: mark qemu-ga VSS includes as system headers
PATCH 1/1 configure: mark qemu-ga VSS includes as system headers
As of e4650c81, we do w32 builds with -Werror enabled. Unfortunately for cases where we enable VSS support in qemu-ga, we still have warnings generated by VSS includes that ship as part of the Microsoft VSS SDK.
We can selectively address a number of these warnings using
#pragma GCC diagnostic ignored ...
but at least one of these:
warning: ‘typedef’ was ignored in this declaration
resulting from declarations of the form:
typedef struct Blah { ... };
does not provide a specific command-line/pragma option to disable warnings of the sort.
To allow VSS builds to succeed, the next-best option is disabling these warnings on a per-file basis. pragmas like #pragma GCC system_header can be used to declare subsequent includes/declarations as being exempt from normal warnings, but this must be done within a header file.
Since we don't control the VSS SDK, we'd need to rely on a intermediate header include to accomplish this, and
since different objects in the VSS link target rely on different headers from the VSS SDK, this would become somewhat of a rat's nest (though not totally unmanageable).
The next step up in granularity is just marking the entire VSS SDK include path as system headers via -isystem. This is a bit more heavy-handed, but since this SDK hasn't changed since 2005, there's likely little to be gained from selectively disabling warnings anyway, so we implement that approach here.
This fixes the -Werror failures in both the configure test and the qga build due to shared reliance on $vss_win32_include. For the same reason, this also enforces a new dependency on -isystem support in the C/C++ compiler when building QGA with VSS enabled.
--- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
configure +3 -3
@@ -4049,13 +4049,13 @@ fi if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then case "$vss_win32_sdk" in - "") vss_win32_include="-I$source_path" ;; + "") vss_win32_include="-isystem $source_path" ;; *\ *) # The SDK is installed in "Program Files" by default, but we cannot # handle path with spaces. So we symlink the headers into ".sdk/vss". - vss_win32_include="-I$source_path/.sdk/vss" + vss_win32_include="-isystem $source_path/.sdk/vss" symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" ;; - *) vss_win32_include="-I$vss_win32_sdk" + *) vss_win32_include="-isystem $vss_win32_sdk" esac cat > $TMPC << EOF #define __MIDL_user_allocate_free_DEFINED__
Signature · 1 line
1.9.1
Quoted 38 lines · Michael Roth
As of
e4650c81, we do w32 builds with -Werror enabled. Unfortunately for cases where we enable VSS support in qemu-ga, we still have warnings generated by VSS includes that ship as part of the Microsoft VSS SDK.We can selectively address a number of these warnings using
#pragma GCC diagnostic ignored ...
but at least one of these:
warning: ‘typedef’ was ignored in this declaration
resulting from declarations of the form:
typedef struct Blah { ... };
does not provide a specific command-line/pragma option to disable warnings of the sort.
To allow VSS builds to succeed, the next-best option is disabling these warnings on a per-file basis. pragmas like #pragma GCC
system_headercan be used to declare subsequent includes/declarations as being exempt from normal warnings, but this must be done within a header file.Since we don't control the VSS SDK, we'd need to rely on a intermediate header include to accomplish this, and
since different objects in the VSS link target rely on different headers from the VSS SDK, this would become somewhat of a rat's nest (though not totally unmanageable).The next step up in granularity is just marking the entire VSS SDK include path as system headers via -isystem. This is a bit more heavy-handed, but since this SDK hasn't changed since 2005, there's likely little to be gained from selectively disabling warnings anyway, so we implement that approach here.
Quoted 4 lines
This fixes the -Werror failures in both the configure test and the qga build due to shared reliance on $vss_win32_include. For the same reason, this also enforces a new dependency on -isystem support in the C/C++ compiler when building QGA with VSS enabled.
Did we ever support any non-GCC-based compiler for building QGA? I don't think so, but in the worst case, we could later add a check whether the compiler supports that parameter, too...
Anyway, I think your patch is a nice and clean way to deal with the error messages from these headers, so:
Quoting Thomas Huth (2016-06-29 03:27:26)
Quoted 39 lines · Michael Roth
Quoted 38 lines
As of
e4650c81, we do w32 builds with -Werror enabled. Unfortunately for cases where we enable VSS support in qemu-ga, we still have warnings generated by VSS includes that ship as part of the Microsoft VSS SDK.We can selectively address a number of these warnings using
#pragma GCC diagnostic ignored ...
but at least one of these:
warning: ‘typedef’ was ignored in this declaration
resulting from declarations of the form:
typedef struct Blah { ... };
does not provide a specific command-line/pragma option to disable warnings of the sort.
To allow VSS builds to succeed, the next-best option is disabling these warnings on a per-file basis. pragmas like #pragma GCC
system_headercan be used to declare subsequent includes/declarations as being exempt from normal warnings, but this must be done within a header file.Since we don't control the VSS SDK, we'd need to rely on a intermediate header include to accomplish this, and
since different objects in the VSS link target rely on different headers from the VSS SDK, this would become somewhat of a rat's nest (though not totally unmanageable).The next step up in granularity is just marking the entire VSS SDK include path as system headers via -isystem. This is a bit more heavy-handed, but since this SDK hasn't changed since 2005, there's likely little to be gained from selectively disabling warnings anyway, so we implement that approach here.
Quoted 8 lines
Quoted 4 lines
This fixes the -Werror failures in both the configure test and the qga build due to shared reliance on $vss_win32_include. For the same reason, this also enforces a new dependency on -isystem support in the C/C++ compiler when building QGA with VSS enabled.
Did we ever support any non-GCC-based compiler for building QGA? I don't think so, but in the worst case, we could later add a check whether the compiler supports that parameter, too...
Not really, but I think it's possible to bootstrap clang using mingw, which is probably a reasonable option to keep open. That was the main reason I wanted to point out the new dependency, but it turns out clang supports -isystem anyway so a check/fallback in configure (like we have for #pragma GCC diagnostic) is probably not not needed atm.
The other possibility is a native MSVC compile, but I doubt that works as is (heavy usage of unistd.h, for instance), and I'm not aware of any good reason to make it work.
Quoted 5 lines
Anyway, I think your patch is a nice and clean way to deal with the error messages from these headers, so:
Reviewed-by Thomas Huth <[email protected]>
Thanks!
Michael Roth
AppliedQuoting Michael Roth (2016-06-28 18:43:46)
Quoted 43 lines
As of
e4650c81, we do w32 builds with -Werror enabled. Unfortunately for cases where we enable VSS support in qemu-ga, we still have warnings generated by VSS includes that ship as part of the Microsoft VSS SDK.We can selectively address a number of these warnings using
#pragma GCC diagnostic ignored ...
but at least one of these:
warning: ‘typedef’ was ignored in this declaration
resulting from declarations of the form:
typedef struct Blah { ... };
does not provide a specific command-line/pragma option to disable warnings of the sort.
To allow VSS builds to succeed, the next-best option is disabling these warnings on a per-file basis. pragmas like #pragma GCC
system_headercan be used to declare subsequent includes/declarations as being exempt from normal warnings, but this must be done within a header file.Since we don't control the VSS SDK, we'd need to rely on a intermediate header include to accomplish this, and
since different objects in the VSS link target rely on different headers from the VSS SDK, this would become somewhat of a rat's nest (though not totally unmanageable).The next step up in granularity is just marking the entire VSS SDK include path as system headers via -isystem. This is a bit more heavy-handed, but since this SDK hasn't changed since 2005, there's likely little to be gained from selectively disabling warnings anyway, so we implement that approach here.
This fixes the -Werror failures in both the configure test and the qga build due to shared reliance on $vss_win32_include. For the same reason, this also enforces a new dependency on -isystem support in the C/C++ compiler when building QGA with VSS enabled.
Quoted 4 lines
Cc Thomas Huth <[email protected]>Cc Stefan Weil <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Michael Roth <[email protected]>
Thanks, applied to qga tree:
https://github.com/mdroth/qemu/commits/qga
Quoted 29 lines
--- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)configure +3
-3@@ -4049,13 +4049,13 @@ fi if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then case "$vss_win32_sdk" in - "") vss_win32_include="-I$source_path" ;; + "") vss_win32_include="-isystem $source_path" ;; *\ *) # The SDK is installed in "Program Files" by default, but we cannot # handle path with spaces. So we symlink the headers into ".sdk/vss". - vss_win32_include="-I$source_path/.sdk/vss" + vss_win32_include="-isystem $source_path/.sdk/vss" symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" ;; - *) vss_win32_include="-I$vss_win32_sdk" + *) vss_win32_include="-isystem $vss_win32_sdk" esac cat > $TMPC << EOF #define __MIDL_user_allocate_free_DEFINED__Signature · 1 line
1.9.1