You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2023/08/17 21:06:25 UTC

[impala] 02/02: IMPALA-12372: Only use -Wno-deprecated-declaration for OpenSSL3

This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 5d0a2f01a52f2660acc1f0f4b3214ca6ecfa66ce
Author: Joe McDonnell <jo...@cloudera.com>
AuthorDate: Wed Aug 16 08:43:00 2023 -0700

    IMPALA-12372: Only use -Wno-deprecated-declaration for OpenSSL3
    
    Redhat 9 and Ubuntu 22.04 both use OpenSSL3, which deprecated
    several APIs that we use. To support those platforms, we added
    the -Wno-deprecated-declaration to the build. Historically, the
    Impala build has also specified -Wno-deprecated due to
    use of deprecated headers in gutils. These flags limit our
    ability to notice use of deprecated code in other parts of the
    code.
    
    The code in gutils no longer requires -Wno-deprecated, so
    this removes it completely. Additionally, this limits the
    -Wno-deprecated-declaration flag to machines using
    OpenSSL 3.
    
    Reenabling deprecation warnings also reenables Clang Tidy's
    clang-diagnostic-deprecated enforcement. This is currently
    broken, so this turns off clang-diagnostic-deprecated
    until it can be addressed properly.
    
    Testing:
     - Ran build-all-options on Ubuntu 22 and Ubuntu 16
     - Ran a Rocky 9.2 build
    
    Change-Id: I1b36450d084f342eeab5dac2272580ab6b0c988b
    Reviewed-on: http://gerrit.cloudera.org:8080/20369
    Reviewed-by: Laszlo Gaal <la...@cloudera.com>
    Reviewed-by: Zoltan Borok-Nagy <bo...@cloudera.com>
    Tested-by: Joe McDonnell <jo...@cloudera.com>
---
 .clang-tidy                 |  1 +
 be/CMakeLists.txt           | 21 ++++++++++++++-------
 be/src/gutil/CMakeLists.txt |  2 +-
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/.clang-tidy b/.clang-tidy
index cc70284e2..47bce4d00 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -36,6 +36,7 @@ Checks: "-*,clang*,\
 -clang-diagnostic-class-varargs,\
 -clang-diagnostic-conversion,\
 -clang-diagnostic-covered-switch-default,\
+-clang-diagnostic-deprecated,\
 -clang-diagnostic-disabled-macro-expansion,\
 -clang-diagnostic-documentation-html,\
 -clang-diagnostic-documentation-unknown-command,\
diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt
index 908b34a2d..e15d21c95 100644
--- a/be/CMakeLists.txt
+++ b/be/CMakeLists.txt
@@ -36,10 +36,6 @@ option(BUILD_WITH_NO_TESTS "Do not generate test and benchmark targets" OFF)
 #  -Wno-unknown-pragmas: suppress warnings for unknown (compiler specific) pragmas
 #  -fsigned-char: on aarch64 platform, type of char default is unsigned char, here
 #        set it to signed-char to be compatible with x86-64
-#  -Wno-deprecated: gutil contains deprecated headers
-#  -Wno-deprecated-declarations: OpenSSL3 deprecated various APIs currently used by
-#       Impala, so this disables those warnings until they can be addressed.
-#       See IMPALA-12226.
 #  -Wno-vla: we use C99-style variable-length arrays
 #  -pthread: enable multithreaded malloc
 #  -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG: enable nanosecond precision for boost
@@ -51,7 +47,7 @@ SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wall -Wno-sign-compare -Wno-unknown-p
 SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -fno-strict-aliasing -fno-omit-frame-pointer")
 SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -fsigned-char")
 SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -std=c++17")
-SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-deprecated -Wno-deprecated-declarations -Wno-vla")
+SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-vla")
 SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG")
 SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_SYSTEM_NO_DEPRECATED")
 SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_BIND_GLOBAL_PLACEHOLDERS")
@@ -63,6 +59,12 @@ SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_ALLOW_DEPRECATED_HEADERS")
 #      isn't supported (e.g., that might happen in containerized deployments).
 SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX")
 SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -B $ENV{IMPALA_TOOLCHAIN_PACKAGES_HOME}/binutils-$ENV{IMPALA_BINUTILS_VERSION}/bin/")
+#  -Wno-deprecated-declarations: OpenSSL3 deprecated various APIs currently used by
+#      Impala, so this disables those warnings when using OpenSSL3 until they can be
+#      addressed. See IMPALA-12226.
+if (OPENSSL_VERSION VERSION_GREATER_EQUAL 3)
+  SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-deprecated-declarations")
+endif()
 IF($ENV{USE_GOLD_LINKER} STREQUAL "true")
   SET(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -fuse-ld=gold")
 ENDIF()
@@ -291,15 +293,20 @@ add_definitions(-DKUDU_HEADERS_USE_RICH_SLICE -DKUDU_HEADERS_NO_STUBS)
 # Set clang flags for cross-compiling to IR.
 # IR_COMPILE is #defined for the cross compile to remove code that bloats the IR.
 # Optimization is omitted and left up to individual uses.
-#  -Wno-deprecated: gutil contains deprecated headers
 #  -Wno-return-type-c-linkage: UDFs return C++ classes but use C linkage to prevent
 #       mangling
 #  -DBOOST_NO_EXCEPTIONS: call a custom error handler for exceptions in codegen'd code.
 set(CLANG_IR_CXX_FLAGS "-emit-llvm" "-c" "-std=c++17" "-DIR_COMPILE" "-DHAVE_INTTYPES_H"
   "-DHAVE_NETINET_IN_H" "-DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG" "-DBOOST_NO_EXCEPTIONS"
   "-DBOOST_BIND_GLOBAL_PLACEHOLDERS" "-DBOOST_ALLOW_DEPRECATED_HEADERS"
-  "-DKUDU_HEADERS_NO_STUBS" "-fcolor-diagnostics" "-Wno-deprecated"
+  "-DKUDU_HEADERS_NO_STUBS" "-fcolor-diagnostics"
   "-Wno-return-type-c-linkage" "-fsigned-char")
+#  -Wno-deprecated-declarations: OpenSSL3 deprecated various APIs currently used by
+#      Impala, so this disables those warnings when using OpenSSL3 until they can be
+#      addressed. See IMPALA-12226.
+if (OPENSSL_VERSION VERSION_GREATER_EQUAL 3)
+  SET(CLANG_IR_CXX_FLAGS "${CLANG_IR_CXX_FLAGS}" "-Wno-deprecated-declarations")
+endif()
 
 if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
   set(CLANG_IR_CXX_FLAGS "${CLANG_IR_CXX_FLAGS}" "-march=armv8-a+crc"
diff --git a/be/src/gutil/CMakeLists.txt b/be/src/gutil/CMakeLists.txt
index 6bb2ccb5f..7e12e84cb 100644
--- a/be/src/gutil/CMakeLists.txt
+++ b/be/src/gutil/CMakeLists.txt
@@ -67,7 +67,7 @@ ADD_EXPORTABLE_LIBRARY(gutil
   SRCS ${GUTIL_SRCS}
   DEPS ${GUTIL_LIBS}
   # Disable warnings which trigger a lot in the Google code:
-  COMPILE_FLAGS "-funsigned-char -Wno-deprecated -Wno-char-subscripts")
+  COMPILE_FLAGS "-funsigned-char -Wno-char-subscripts")
 
 if (BUILD_WITH_NO_TESTS)
   return()