You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2023/04/22 00:11:46 UTC
[kudu] 01/02: [util] use include guard macro in int128.h header
This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 59922c19ccd7a963412f814cfbd1da9320a99b94
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Fri Apr 21 12:57:58 2023 -0700
[util] use include guard macro in int128.h header
Even if '#pragma once' is supported by the vast majority of modern
compilers, it is a non-standard one [1]. The src/kudu/util/int128.h
file is included into other header files of the C++ Kudu client API,
which is supposed to be C++98 compliant. Since other header files
in the C++ client API are using include guard macros, let's use
the same technique for int128.h as well.
Doing so addresses a warning produced by the CLANG when running
client_examples_test.sh, while a standalone compilation is done on the
kudu/util/int128.h file:
#pragma once in main file [-Wpragma-once-outside-header]
[1] https://en.cppreference.com/w/cpp/preprocessor/impl
Change-Id: Ica18bbdc8eff034965e1a69404df2180cacf7bb4
Reviewed-on: http://gerrit.cloudera.org:8080/19783
Reviewed-by: Abhishek Chennaka <ac...@cloudera.com>
Tested-by: Alexey Serbin <al...@apache.org>
---
src/kudu/util/int128.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/kudu/util/int128.h b/src/kudu/util/int128.h
index ac35d081f..6fbdc31e4 100644
--- a/src/kudu/util/int128.h
+++ b/src/kudu/util/int128.h
@@ -18,7 +18,9 @@
// This file is the central location for defining the int128 type
// used by Kudu. Though this file is small it ensures flexibility
// as choices and standards around int128 change.
-#pragma once
+
+#ifndef KUDU_UTIL_INT128_H_
+#define KUDU_UTIL_INT128_H_
// __int128 is not supported before gcc 4.6
#if defined(__clang__) || \
@@ -44,3 +46,5 @@ static const int128_t INT128_MIN = (-INT128_MAX - 1);
} // namespace kudu
#endif
+
+#endif // #ifndef KUDU_UTIL_INT128_H_ ...