protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.2k stars 15.44k forks source link

MSC compile warnings #17821

Open torsten48 opened 1 month ago

torsten48 commented 1 month ago

What version of protobuf and what language are you using? 28.0-rc2 Language: C++/

What operating system (Linux, Windows, ...) and version? Windows 10

What runtime / compiler are you using (e.g., python version or gcc version) MSVC 19.40.33811.0 (64bit) Windows SDK 10.0.22621.0 cmake 3.30.2

What did you do? Steps to reproduce the behavior: build protobuf via cmake

What did you expect to see no warnings

What did you see instead? protobuf\third_party\utf8_range\utf8_range.c(38): warning C4141: 'inline': used more than once protobuf\third_party\utf8_range\utf8_range.c(45): warning C4141: 'inline': used more than once protobuf\third_party\utf8_range\utf8_range.c(49): warning C4141: 'inline': used more than once protobuf\third_party\utf8_range\utf8_range.c(178): warning C4141: 'inline': used more than once protobuf\upb\mem\arena.c(327): warning C4116: unnamed type definition in parentheses protobuf\src\google\protobuf\wire_format_lite.cc(669): warning C4068: unknown pragma 'clang' protobuf\src\google\protobuf\wire_format_lite.cc(711): warning C4068: unknown pragma 'clang'

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment

bebuch commented 1 week ago

MSVC issues a warning here because both __forceinline and inline are declared.

@grpc-devs: Is changing PROTOBUF_ALWAYS_INLINE from __forceinline to [[msvc::forceinline]] an option? This should solve the issue.

googleberg commented 1 week ago

@ericsalo can you see if theres a straightforward fix for this?