This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch branch-1.17.x
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/branch-1.17.x by this push:
new 20d04298d [util] use include guard macro in int128.h header
20d04298d is described below
commit 20d04298dd891cd3b04966ddd5b44e7e201ecb27
Author: Alexey Serbin <[email protected]>
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 <[email protected]>
Tested-by: Alexey Serbin <[email protected]>
---
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_ ...