empiredan commented on PR #2253:
URL: 
https://github.com/apache/incubator-pegasus/pull/2253#issuecomment-2899873989

   Compilation failed with the following error:
   ```
   [ 95%] Building C object src/shell/CMakeFiles/pegasus_shell.dir/sds/sds.c.o
   /__w/incubator-pegasus/incubator-pegasus/src/shell/sds/sds.c: In function 
'sdsMakeRoomFor':
   /__w/incubator-pegasus/incubator-pegasus/src/shell/sds/sds.c:200:25: error: 
variable 'reqlen' set but not used [-Werror=unused-but-set-variable]
     200 |     size_t len, newlen, reqlen;
         |                         ^~~~~~
   /__w/incubator-pegasus/incubator-pegasus/src/shell/sds/sds.c: At top level:
   cc1: note: unrecognized command-line option 
'-Wno-inconsistent-missing-override' may have been intended to silence earlier 
diagnostics
   cc1: all warnings being treated as errors
   make[2]: *** [src/shell/CMakeFiles/pegasus_shell.dir/build.make:303: 
src/shell/CMakeFiles/pegasus_shell.dir/sds/sds.c.o] Error 1
   make[2]: *** Waiting for unfinished jobs....
   [ 95%] Building CXX object 
src/server/test/CMakeFiles/pegasus_unit_test.dir/__/pegasus_server_impl.cpp.o
   [ 95%] Building CXX object 
src/server/CMakeFiles/pegasus_server.dir/rocksdb_wrapper.cpp.o
   make[1]: *** [CMakeFiles/Makefile2:3916: 
src/shell/CMakeFiles/pegasus_shell.dir/all] Error 2
   make[1]: *** Waiting for unfinished jobs....
   ```
   
   The root cause is that the CI builds in **release mode** (see 
[lint_and_test_cpp.yaml#L119](https://github.com/apache/incubator-pegasus/blob/master/.github/workflows/lint_and_test_cpp.yaml#L119)),
 rather than in debug mode. In release mode, the statement `assert(hdrlen + 
newlen + 1 > reqlen);` gets optimized away, leading to the compiler warning 
that `reqlen` is set but not used.
   
   In fact, the same purpose can be achieved without using the `reqlen` 
variable. However, doing so would introduce a significant difference from the 
changes in 
https://github.com/redis/redis/commit/c6ad876774f3cc11e32681ea02a2eead00f2c521, 
which may lead to more conflicts when merging code in the future. Therefore, we 
can use `UNUSED` to silence the unused variable warning for `reqlen`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to