opentelemetry-cpp-contrib icon indicating copy to clipboard operation
opentelemetry-cpp-contrib copied to clipboard

Unused parameter warning when compiling the Nginx module

Open rcjsuen opened this issue 3 years ago • 0 comments

Describe your environment I'm compiling inside a k8s.gcr.io/ingress-nginx/controller:v0.46.0 Docker image but the same thing can be seen in the output of the GitHub Actions so I don't think it's environment-specific here.

Steps to reproduce

$ mkdir build
$ cd build
$ cmake -DCMAKE_TYPE=RELEASE -DNGINX_BIN=/etc/nginx/nginx \
           -DCMAKE_PREFIX_PATH=/install -DCMAKE_INSTALL_PREFIX=/etc/nginx/modules \
           -DNGINX_VERSION=1.18.0 \
           -DCURL_LIBRARY=/usr/lib/libcurl.so.4 ..
$ make -j2
  1. Follow the build instructions and build the library.
  2. You'll see warnings about an unused parameter.
/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp: In function 'ngx_int_t OtelGetTraceId(ngx_http_request_t*, ngx_http_variable_value_t*, uintptr_t)':
/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp:229:81: warning: unused parameter 'data' [-Wunused-parameter]
  229 | OtelGetTraceId(ngx_http_request_t* req, ngx_http_variable_value_t* v, uintptr_t data) {
      |                                                                       ~~~~~~~~~~^~~~
/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp: In function 'ngx_int_t OtelGetSpanId(ngx_http_request_t*, ngx_http_variable_value_t*, uintptr_t)':
/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp:278:80: warning: unused parameter 'data' [-Wunused-parameter]
  278 | OtelGetSpanId(ngx_http_request_t* req, ngx_http_variable_value_t* v, uintptr_t data) {
      |                                                                      ~~~~~~~~~~^~~~

What is the expected behavior? Compilation should be smooth without any warnings. Whenever the compiler prints something it raises alarms that there may be something wrong or misconfigured in the compilation process.

What is the actual behavior? I see two warnings about some unused parameter.

Additional context This can be seen in the build nginx docker step in a GitHub Action build output

rcjsuen avatar Dec 16 '21 12:12 rcjsuen