-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-41367: [C++] Replace [[maybe_unused]] with Arrow macro #41359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Could you open a new issue for this? In general, we use one issue per PR. |
|
@github-actions crossbow submit almalinux-8-amd64 |
|
Revision: 9abc710 Submitted crossbow builds: ursacomputing/crossbow @ actions-4f5b08fc0b
|
|
|
|
As far as I can tell none of the current CI failures are related to this change |
|
The "AMD64 macOS 12 GLib & Ruby" failure: #41369 |
|
The "AMD64 macOS 12 MATLAB" failure: #41370 |
|
The "Source Release and Merge Script on macos-latest" failure: #41371 |
cpp/src/arrow/device.h
Outdated
| virtual Result<std::shared_ptr<Stream>> WrapStream(void* device_stream, | ||
| Stream::release_fn_t release_fn) { | ||
| ARROW_UNUSED(device_stream); | ||
| ARROW_UNUSED(release_fn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use ARROW_ARG_UNUSED() by adding ARROW_ARG_UNUSED(x)=x to Doxygen's PREDEFINED?
(ARROW_ARG_UNUSED(x)=x is added and the list is sorted.)
diff --git a/cpp/apidoc/Doxyfile b/cpp/apidoc/Doxyfile
index e19c933cd4..5be93032c0 100644
--- a/cpp/apidoc/Doxyfile
+++ b/cpp/apidoc/Doxyfile
@@ -2168,16 +2168,17 @@ INCLUDE_FILE_PATTERNS =
PREDEFINED = __attribute__(x)= \
__declspec(x)= \
- PARQUET_EXPORT= \
- GANDIVA_EXPORT= \
- ARROW_EXPORT= \
ARROW_ACERO_EXPORT= \
+ ARROW_ARG_UNUSED(x)=x \
+ ARROW_DEPRECATED(x)= \
ARROW_DS_EXPORT= \
ARROW_ENGINE_EXPORT= \
+ ARROW_EXPORT= \
+ ARROW_EXTERN_TEMPLATE= \
ARROW_FLIGHT_EXPORT= \
ARROW_FLIGHT_SQL_EXPORT= \
- ARROW_EXTERN_TEMPLATE= \
- ARROW_DEPRECATED(x)=
+ GANDIVA_EXPORT= \
+ PARQUET_EXPORT=
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. TheThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can get this to work with smaller examples but no such luck yet with the Arrow build. Need to investigate further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some more digging it seems like what you suggested works for Doxygen to generate the appropriate output, but that seems to have no bearing on clang. I think this issue upstream is related llvm/llvm-project#77489
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an MRE.
test.cc:
#define ARG_UNUSED(x)
/// @brief A function
///
/// @param foo - this is not really used
void SomeFunction(void ARG_UNUSED(foo)) {
return;
}Doxyfile:
PROJECT_NAME = foo
INPUT = test.cc
MACRO_EXPANSION = YES
PREDEFINED = ARG_UNUSED(x)=x
doxygen -d Preprocessor output:
Doxygen version used: 1.9.1
Searching for include files...
Searching for example files...
Searching for images...
Searching for dot files...
Searching for msc files...
Searching for dia files...
Searching for files to exclude
Searching INPUT for files to process...
Reading and parsing tag files
Parsing files
Preprocessing /home/willayd/Desktop/test.cc...
Preprocessor output of /home/willayd/Desktop/test.cc (size: 134 bytes):
---------
00001 #define ARG_UNUSED(x)
00002
00003 /// @brief A function
00004 ///
00005 /// @param foo - this is not really used
00006 void SomeFunction(void foo ) {
00007 return;
00008 }
00009
---------
Macros accessible in this file (/home/willayd/Desktop/test.cc):
---------
ARG_UNUSED
---------
clang++ test.cc -Wdocumentation -shared output:
test.cc:5:12: warning: parameter 'foo' not found in the function declaration [-Wdocumentation]
/// @param foo - this is not really used
^~~
1 warning generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh... How about this?
diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake
index d56609c123..ea357b4779 100644
--- a/cpp/cmake_modules/SetupCxxFlags.cmake
+++ b/cpp/cmake_modules/SetupCxxFlags.cmake
@@ -314,6 +314,7 @@ if("${BUILD_WARNING_LEVEL}" STREQUAL "CHECKIN")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wall")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wextra")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wdocumentation")
+ set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DARROW_WARN_DOCUMENTATION")
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
# size_t is 32 bit in Emscripten wasm32 - ignore conversion errors
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-shorten-64-to-32")
diff --git a/cpp/src/arrow/util/macros.h b/cpp/src/arrow/util/macros.h
index d80828869b..6faf25b3c9 100644
--- a/cpp/src/arrow/util/macros.h
+++ b/cpp/src/arrow/util/macros.h
@@ -67,7 +67,11 @@
// [5] J. Doerfert et al. 2019. "Performance Exploration Through Optimistic Static
// Program Annotations". https://github.com/jdoerfert/PETOSPA/blob/master/ISC19.pdf
#define ARROW_UNUSED(x) (void)(x)
+#ifdef ARROW_WARN_DOCUMENTATION
+#define ARROW_ARG_UNUSED(x) x
+#else
#define ARROW_ARG_UNUSED(x)
+#endif
#if defined(__GNUC__) // GCC and compatible compilers (clang, Intel ICC)
#define ARROW_NORETURN __attribute__((noreturn))
#define ARROW_NOINLINE __attribute__((noinline))There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed up this change
This reverts commit 84cc37e.
|
@github-actions crossbow submit centos |
|
Revision: dd0c7d4 Submitted crossbow builds: ursacomputing/crossbow @ actions-71b6b957bd
|
This reverts commit dd0c7d4.
|
@github-actions crossbow submit preview-docs |
|
Revision: bdf0bff Submitted crossbow builds: ursacomputing/crossbow @ actions-eb949ffd4d
|
|
@github-actions crossbow submit test-r-rstudio-r-base-4.1-opensuse153 |
|
Revision: bdf0bff Submitted crossbow builds: ursacomputing/crossbow @ actions-8f6e4a0c9c
|
kou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
|
After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 5ee70ee. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 8 possible false positives for unstable benchmarks that are known to sometimes produce them. |
…he#41359) ### Rationale for this change This is a follow up to apache#41111 which was created as an issue in apache#41367 ### What changes are included in this PR? Replace [[maybe_unused]] with Arrow macro ### Are these changes tested? Builds cleanly ### Are there any user-facing changes? No * GitHub Issue: apache#41367 Authored-by: Will Ayd <william.ayd@icloud.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Rationale for this change
This is a follow up to #41111 which was created as an issue in #41367
What changes are included in this PR?
Replace [[maybe_unused]] with Arrow macro
Are these changes tested?
Builds cleanly
Are there any user-facing changes?
No