google / jwt_verify_lib

Provide c++ library to verify JWT tokens
Apache License 2.0
42 stars 43 forks source link

GCC warns about `getStatusString()` #91

Closed nak3 closed 1 year ago

nak3 commented 1 year ago

When g++ compiles the code, it produces the following warning message.

external/com_github_google_jwt_verify/src/status.cc: In function 'std::string google::jwt_verify::getStatusString(google::jwt_verify::Status)':
external/com_github_google_jwt_verify/src/status.cc:182:1: warning: control reaches end of non-void function [-Wreturn-type]
  182 | }
      | ^

It seems that return "" was dropped by recent change - https://github.com/google/jwt_verify_lib/commit/ae1bb0512e67f654bb4e9d741de424547dac801f

While clang does not produce the warning when all enum is covered by switch, GNU GCC complains about it. So I initially thought that it is a gcc issue but it seems gcc is correct and they have the FAQ - https://gcc.gnu.org/wiki/VerboseDiagnostics#enum_switch

env: g++ (GCC) 11.3.1 20220421

qiwzhang commented 1 year ago

Please file a pr to add it back. Thanks.