mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 13:34:53 +00:00
[SDK] Add GCC overrides for SAL annotations
GCC has some functions, variables & type attributes which can be used as aliases for some of the SAL annotations. Although it's not as rich & precise, it's still useful since we actually enable -Werror on GCC builds whereas we don't use such an option on MSVC builds. For now, _Must_inspect_result_ is aliased to warn_result_unused attribute.
This commit is contained in:
parent
a28a34f108
commit
d1f5c31820
|
@ -1,6 +1,11 @@
|
||||||
|
|
||||||
PROJECT(NTOS)
|
PROJECT(NTOS)
|
||||||
|
|
||||||
|
if (GCC)
|
||||||
|
# Enable this again. CORE-17637
|
||||||
|
add_compile_options(-Wunused-result)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(ntos.cmake)
|
include(ntos.cmake)
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
||||||
|
|
|
@ -102,6 +102,7 @@ add_compile_options(-Wno-char-subscripts -Wno-multichar -Wno-unused-value)
|
||||||
add_compile_options(-Wno-unused-const-variable)
|
add_compile_options(-Wno-unused-const-variable)
|
||||||
add_compile_options(-Wno-unused-local-typedefs)
|
add_compile_options(-Wno-unused-local-typedefs)
|
||||||
add_compile_options(-Wno-deprecated)
|
add_compile_options(-Wno-deprecated)
|
||||||
|
add_compile_options(-Wno-unused-result) # FIXME To be removed when CORE-17637 is resolved
|
||||||
|
|
||||||
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||||
add_compile_options(-Wno-maybe-uninitialized)
|
add_compile_options(-Wno-maybe-uninitialized)
|
||||||
|
|
22
sdk/include/psdk/gcc_sal.h
Normal file
22
sdk/include/psdk/gcc_sal.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS PSDK
|
||||||
|
* LICENSE: MIT (https://spdx.org/licenses/MIT)
|
||||||
|
* PURPOSE: Standard Annotation Language (SAL) definitions - GCC overrides
|
||||||
|
* COPYRIGHT: 2021 - Jérôme Gardou
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __GNUC__
|
||||||
|
#error "Not for your compiler!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __has_attribute
|
||||||
|
#pragma GCC warning "GCC without __has_attribute, no SAL niceties for you"
|
||||||
|
#define __has_attribute(__x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_attribute(warn_unused_result)
|
||||||
|
# undef _Must_inspect_result_
|
||||||
|
# define _Must_inspect_result_ __attribute__((__warn_unused_result__))
|
||||||
|
#endif
|
2965
sdk/include/psdk/ms_sal.h
Normal file
2965
sdk/include/psdk/ms_sal.h
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -5,6 +5,11 @@ add_definitions(
|
||||||
-D_NTSYSTEM_
|
-D_NTSYSTEM_
|
||||||
-D_NTDLLBUILD_)
|
-D_NTDLLBUILD_)
|
||||||
|
|
||||||
|
if (GCC)
|
||||||
|
# Enable this again. CORE-17637
|
||||||
|
add_compile_options(-Wunused-result)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
access.c
|
access.c
|
||||||
acl.c
|
acl.c
|
||||||
|
|
Loading…
Reference in a new issue