darion-yaphet opened a new pull request, #3506:
URL: https://github.com/apache/brpc/pull/3506

   ### What problem does this PR solve?
   
     Problem Summary:
   
     CMake puts `${PROJECT_SOURCE_DIR}/src` ahead of 
`${CMAKE_CURRENT_BINARY_DIR}` on the include path. Make generates protobuf 
headers in-tree  (`src/**/*.pb.h`, gitignored). After a `.proto` update, CMake 
already writes the new header into the build directory, but the compiler still 
picks  the leftover in-source file.
     This showed up after #3469 (`EPROGREADTIMEOUT`):
   
     src/brpc/controller.cpp:76:28: error: no member named 'EPROGREADTIMEOUT' 
in namespace 'brpc'
   
     `src/brpc/errno.proto` and `build/brpc/errno.pb.h` both had 
`EPROGREADTIMEOUT = 1019`; the stale `src/brpc/errno.pb.h` still stopped at 
`EREJECT =  1018`.
   
     ### What is changed and the side effects?
     Changed:
     - Search `${CMAKE_CURRENT_BINARY_DIR}` before `src/` in 
`BRPC_COMMON_INCLUDE_DIRS`.
     - Mark the build directory as `BEFORE` on `brpc_common_config` so leftover 
Make-generated `*.pb.h` cannot shadow updated generated headers.
     Side effects:
     - Performance effects: none. Compile-time include order only; no runtime 
change.
     - Breaking backward compatibility: no. Generated headers remain the source 
of truth. In-source `*.pb.h` from Make is still valid when it is up to  date; 
it just no longer wins over a newer build-dir copy. Existing Make and Bazel 
flows are unchanged.
   
     ---
   
     ### Check List:
     - Please make sure your changes are compilable.
     - When providing us with a new feature, it is best to add related tests.
     - Please follow [Contributor Covenant Code of 
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
   


-- 
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