Shadowed variables can cause readability issues. Ensure a shadowed
variable isn't used in header files which may be used in a dependent
project that explicitly disables them.
Chrome is running into two issues with the use of this macro
in open-source protobuf (https://crbug.com/809157):
1. GOOGLE_FALLTHROUGH_INTENDED is defined to nothing on __APPLE__
platforms, which blocks us from enabling -Wimplicit-fallthrough
on Mac and iOS. (We use a hermetic self-built modern clang,
so whatever Xcode bug that exclusion might be for doesn't apply
to us.)
2. It's in a public header file, and it's included in a public header file.
When clang suggests adding [[clang::fallthrough]], it checks if it knows of
a macro expanding to that and if so, suggests inserting that. Since lots of
chrome code includes protobuf headers, it often suggests inserting
GOOGLE_FALLTHROUGH_INTENDED (from protobuf) instead of the correct
FALLTHROUGH (from chrome's base).
Since the fallthrough doens't do anyting useful, just remove it.
Long ago, this might have had perf impact, but d64a2d9941 added a
parsing fast path that calls this switch as slow fallback, so it should
be off the hot path nowadays.
No intended behavior change.
This is the public version of internal change 184824132.
Fixes issue #1154 by noting that `vcpkg` contains protobuf. Potential improvements: also remark how to use `vcpkg` to get dependencies when building from source via CMake.
These statements pulled a bunch of symbols from the std namespace into
the global namespace. This commit removes all of them except for
std::string, which is a bit trickier to remove.
The generated code for enums needs atomics support, so generate the
import instead of relying on it via transitive imports. This will
make future changes to this likely likely to break generated code
and runtime support are mixed.
Followup to https://github.com/google/protobuf/pull/4184.
The valueOf method on enums is deprecated, but for compatibility reasons
the generated code has to keep using it. We can use an annotation to
suppress the deprecation warnings.
Before the change, an implicit Flush() will be triggered in the
destructor of the input stream. However, the return code of Flush() is
not discarded. This change makes sure when Flush() fails, we will
return false.
This fixes the following build error:
oldpwd=`pwd` && cd .../protobuf/src && \
$oldpwd/js_embed google/protobuf/compiler/js/well_known_types/any.js google/protobuf/compiler/js/well_known_types/struct.js google/protobuf/compiler/js/well_known_types/timestamp.js > $oldpwd/google/protobuf/compiler/js/well_known_types_embed.cc
/bin/bash: line 1: .../protobuf/target/src/google/protobuf/compiler/js/well_known_types_embed.cc: No such file or directory
Makefile:8201: recipe for target 'google/protobuf/compiler/js/well_known_types_embed.cc' failed
which is observed during the cross-compilation since the version 3.2.
If the test cannot find a temp directory by
checking environment variables, it will fall back
to using the current working directory as the temp
directory root.
This is what the test used to do as of commit
6de51caed5
and what was then changed by commit
792d098769
Do not use "googletest.h", apprently that leads to
linking errors on Windows which I couldn't figure
out how to solve, and decided to just go with
plain gTest instead.
See https://github.com/google/protobuf/issues/3951