You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2023/01/24 08:13:10 UTC

[arrow] branch master updated: GH-33787: [C++] Suppress unused-value warning from LinuxParseCpuFlags() on s390x (#33828)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f3966acd8e GH-33787: [C++] Suppress unused-value warning from LinuxParseCpuFlags() on s390x (#33828)
f3966acd8e is described below

commit f3966acd8e675a1a4e52633258f0237be677f81c
Author: Aliaksei Makarau <36...@users.noreply.github.com>
AuthorDate: Tue Jan 24 09:13:04 2023 +0100

    GH-33787: [C++] Suppress unused-value warning from LinuxParseCpuFlags() on s390x (#33828)
    
    ### Rationale for this change
    
    Building at the s390x with the -Werror triggers an error:
    
        arrow/cpp/src/arrow/util/cpu_info.cc:155:3: error: statement has no effect [-Werror=unused-value].
    
    ### What changes are included in this PR?
    
    Just returns `0` in `LinuxParseCpuFlags()` on non-(x86_64|arm64) environment.
    
    ### Are these changes tested?
    
    Local test.
    
    ### Are there any user-facing changes?
    
    No.
    
    Closes https://github.com/apache/arrow/issues/33787.
    
    Signed-off-by: Aliaksei Makarau <aliaksei.makarau@ ibm.com>
    
    Authored-by: Aliaksei Makarau <al...@ibm.com>
    Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
 cpp/src/arrow/util/cpu_info.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cpp/src/arrow/util/cpu_info.cc b/cpp/src/arrow/util/cpu_info.cc
index 9bc33f0457..7c2e9fa921 100644
--- a/cpp/src/arrow/util/cpu_info.cc
+++ b/cpp/src/arrow/util/cpu_info.cc
@@ -345,6 +345,7 @@ int64_t LinuxGetCacheSize(int level) {
 // care about are present.
 // Returns a bitmap of flags.
 int64_t LinuxParseCpuFlags(const std::string& values) {
+#if defined(CPUINFO_ARCH_X86) || defined(CPUINFO_ARCH_ARM)
   const struct {
     std::string name;
     int64_t flag;
@@ -376,6 +377,9 @@ int64_t LinuxParseCpuFlags(const std::string& values) {
     }
   }
   return flags;
+#else
+  return 0;
+#endif
 }
 
 void OsRetrieveCacheSize(std::array<int64_t, kCacheLevels>* cache_sizes) {