From: bangerth Date: Fri, 28 Sep 2012 01:00:51 +0000 (+0000) Subject: Make sure the compiler actually warns. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30e3583045a5441a453a0244025406cd7fe851cd;p=dealii-svn.git Make sure the compiler actually warns. git-svn-id: https://svn.dealii.org/branches/branch_cmake@26815 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/checks/check_for_compiler_features.cmake b/deal.II/cmake/checks/check_for_compiler_features.cmake index 7363c14813..f112d030fd 100644 --- a/deal.II/cmake/checks/check_for_compiler_features.cmake +++ b/deal.II/cmake/checks/check_for_compiler_features.cmake @@ -413,6 +413,8 @@ ENDIF() # variable in config.h), i.e., to something the compiler will # ignore # + +# first see if the compiler accepts the attribute CHECK_CXX_SOURCE_COMPILES( " int old_fn () __attribute__((deprecated)); @@ -423,8 +425,26 @@ CHECK_CXX_SOURCE_COMPILES( " DEAL_II_COMPILER_HAS_ATTRIBUTE_DEPRECATED) -IF(DEAL_II_COMPILER_HAS_ATTRIBUTE_DEPRECATED) +# ...and then verify whether it actually errors out if +# -Werror is given +ADD_FLAGS(CMAKE_REQUIRED_FLAGS "-Werror") +CHECK_CXX_SOURCE_COMPILES( + " + int old_fn () __attribute__((deprecated)); + int old_fn () { return 0; } + int (*fn_ptr)() = old_fn; + + int main () {} + " + DEAL_II_COMPILER_HAS_ATTRIBUTE_DEPRECATED_WARNING) +STRIP_FLAG(CMAKE_REQUIRED_FLAGS "-Werror") + +IF(DEAL_II_COMPILER_HAS_ATTRIBUTE_DEPRECATED + AND + (NOT DEAL_II_COMPILER_HAS_ATTRIBUTE_DEPRECATED_WARNING)) + MESSAGE(STATUS "Compiler supports the deprecated attribute") SET(DEAL_II_DEPRECATED "__attribute__((deprecated))") ELSE() + MESSAGE(STATUS "Compiler does not support the deprecated attribute") SET(DEAL_II_DEPRECATED " ") ENDIF()