Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Swift Package Manager support #7047

Closed
UInt2048 opened this issue Dec 25, 2019 · 1 comment
Closed

Feature Request: Swift Package Manager support #7047

UInt2048 opened this issue Dec 25, 2019 · 1 comment

Comments

@UInt2048
Copy link

UInt2048 commented Dec 25, 2019

What language does this apply to?
If it's a proto syntax change, is it for proto2 or proto3? N/A
If it's about generated code change, what programming language? N/A

Describe the problem you are trying to solve.
I am trying to convert a repository from CocoaPods to Swift Package Manager, but this dependency doesn't support it.

Describe the solution you'd like
I would like this repository to have a Package.swift file to support Swift Package Manager.

Describe alternatives you've considered

  1. I have considered using something instead of Protobuf, but it currently works in the repository.
  2. Additionally, I have considered not converting to Swift Package Manager, but it seems more practical than CocoaPods.
  3. Finally, I have considered attempting to implement this myself, but picking out the correct source files proved to be difficult.

Additional context
Add any other context or screenshots about the feature request here.

@UInt2048
Copy link
Author

UInt2048 commented Jun 13, 2020

Closing as explained in the PR referenced. This can be reopened if needed.

florin-crisan added a commit to florin-crisan/protobuf that referenced this issue Jun 15, 2021
In preparation of fix for protocolbuffers#7047.

Otherwise we get errors like this on Visual C++ 2019 x64:
```
FAILED: CMakeFiles/gmock.dir/C_/Projects/_Extern/Source/Google_Protocol_Buffers/third_party/googletest/googletest/src/gtest-all.cc.obj
C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.300\bin\Hostx64\x64\cl.exe  /nologo /TP -DGOOGLE_PROTOBUF_CMAKE_BUILD -DHAVE_ZLIB -I"C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include" -I. -I"C:\Projects\ Extern\Source\Google Protocol Buffers\src" -I"C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock" -I"C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest" -I"C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\include" -I"C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include" /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1   /MP /wd4018 /wd4065 /wd4146 /wd4244 /wd4251 /wd4267 /wd4305 /wd4307 /wd4309 /wd4334 /wd4355 /wd4506 /wd4800 /wd4996 /bigobj /showIncludes /FoCMakeFiles\gmock.dir\C_\Projects\_Extern\Source\Google_Protocol_Buffers\third_party\googletest\googletest\src\gtest-all.cc.obj /FdCMakeFiles\gmock.dir\gmock.pdb /FS -c "C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src\gtest-all.cc"
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(126): error C2061: syntax error: identifier 'Int32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(130): error C2065: 'Int32': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(130): error C2146: syntax error: missing ')' before identifier 'random_seed_flag'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(130): error C2143: syntax error: missing ';' before '{'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(130): error C2447: '{': missing function header (old-style formal list?)
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(216): error C2039: 'Int32': is not a member of 'testing::internal'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(75): note: see declaration of 'testing::internal'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(216): error C3646: 'random_seed_': unknown override specifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(216): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(217): error C2039: 'Int32': is not a member of 'testing::internal'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(75): note: see declaration of 'testing::internal'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(217): error C3646: 'repeat_': unknown override specifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(217): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(219): error C2039: 'Int32': is not a member of 'testing::internal'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(75): note: see declaration of 'testing::internal'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(219): error C3646: 'stack_trace_depth_': unknown override specifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(219): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(172): error C2065: 'random_seed_': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(173): error C2065: 'repeat_': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(175): error C2065: 'stack_trace_depth_': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(194): error C2065: 'random_seed_': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(195): error C2065: 'repeat_': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(197): error C2065: 'stack_trace_depth_': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(230): error C2065: 'UInt32': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(230): error C2146: syntax error: missing ')' before identifier 'code_point'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(266): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest-internal-inl.h(266): error C2146: syntax error: missing ';' before identifier 'Int32FromEnvOrDie'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): error C2143: syntax error: missing ';' before 'testing::internal::Random::Generate'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): error C2146: syntax error: missing ')' before identifier 'range'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): error C2143: syntax error: missing ';' before '{'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): error C2447: '{': missing function header (old-style formal list?)
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1751): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1751): error C2373: 'testing::internal::UInt32': redefinition; different type modifiers
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): note: see declaration of 'testing::internal::UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1751): error C2146: syntax error: missing ';' before identifier 'kMaxCodePoint1'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1751): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1751): error C2061: syntax error: identifier 'UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1754): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1754): error C2373: 'testing::internal::UInt32': redefinition; different type modifiers
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): note: see declaration of 'testing::internal::UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1754): error C2146: syntax error: missing ';' before identifier 'kMaxCodePoint2'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1754): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1754): error C2061: syntax error: identifier 'UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1757): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1757): error C2373: 'testing::internal::UInt32': redefinition; different type modifiers
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): note: see declaration of 'testing::internal::UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1757): error C2146: syntax error: missing ';' before identifier 'kMaxCodePoint3'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1757): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1757): error C2061: syntax error: identifier 'UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1760): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1760): error C2373: 'testing::internal::UInt32': redefinition; different type modifiers
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): note: see declaration of 'testing::internal::UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1760): error C2146: syntax error: missing ';' before identifier 'kMaxCodePoint4'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1760): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1760): error C2061: syntax error: identifier 'UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1765): error C7525: inline variables require at least '/std:c++17'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1765): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1765): error C2086: 'int testing::internal::UInt32': redefinition
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): note: see declaration of 'testing::internal::UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1765): error C2146: syntax error: missing ';' before identifier 'ChopLowBits'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1765): error C2065: 'bits': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1765): error C2062: type 'int' unexpected
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1765): error C2143: syntax error: missing ';' before '{'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1765): error C2447: '{': missing function header (old-style formal list?)
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1777): error C2146: syntax error: missing ')' before identifier 'code_point'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1777): error C2143: syntax error: missing ';' before '{'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1777): error C2447: '{': missing function header (old-style formal list?)
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1818): error C7525: inline variables require at least '/std:c++17'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1818): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1818): error C2086: 'int testing::internal::UInt32': redefinition
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(340): note: see declaration of 'testing::internal::UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1818): error C2146: syntax error: missing ';' before identifier 'CreateCodePointFromUtf16SurrogatePair'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1819): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1820): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1820): error C2146: syntax error: missing ';' before identifier 'mask'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1820): error C2065: 'mask': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1822): error C2065: 'mask': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1822): error C2065: 'mask': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1825): error C2061: syntax error: identifier 'UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1826): warning C4508: 'testing::internal::CreateCodePointFromUtf16SurrogatePair': function should return a value; 'void' return type assumed
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1847): error C2146: syntax error: missing ';' before identifier 'unicode_code_point'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1847): error C2065: 'unicode_code_point': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1852): error C2065: 'unicode_code_point': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1856): error C2065: 'unicode_code_point': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1856): error C2061: syntax error: identifier 'UInt32'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1859): error C2065: 'unicode_code_point': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(1859): error C3861: 'CodePointToUtf8': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(2078): error C2065: 'test_properites_mutex_': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(2920): error C2065: 'GTestColor': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(2920): error C2146: syntax error: missing ')' before identifier 'color'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(2920): error C2143: syntax error: missing ';' before '{'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(2920): error C2447: '{': missing function header (old-style formal list?)
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(2940): error C2065: 'GTestColor': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(2940): error C2146: syntax error: missing ')' before identifier 'color'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(2940): error C2143: syntax error: missing ';' before '{'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(2940): error C2447: '{': missing function header (old-style formal list?)
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3017): error C2065: 'GTestColor': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3017): error C2146: syntax error: missing ')' before identifier 'color'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3017): error C2143: syntax error: missing ';' before '{'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3017): error C2447: '{': missing function header (old-style formal list?)
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3127): error C2065: 'COLOR_YELLOW': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3127): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3132): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3132): error C2146: syntax error: missing ';' before identifier 'shard_index'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3132): error C2065: 'shard_index': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3132): error C3861: 'Int32FromEnvOrDie': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3133): error C2065: 'COLOR_YELLOW': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3135): error C2065: 'shard_index': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3133): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3140): error C2065: 'COLOR_YELLOW': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3140): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3145): error C2065: 'COLOR_GREEN': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3145): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3154): error C2065: 'COLOR_GREEN': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3154): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3162): error C2065: 'COLOR_GREEN': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3162): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3173): error C2065: 'COLOR_GREEN': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3173): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3198): error C2065: 'COLOR_GREEN': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3198): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3200): error C2065: 'COLOR_GREEN': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3200): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3202): error C2065: 'COLOR_RED': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3202): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3222): error C2065: 'COLOR_GREEN': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3222): error C3861: 'ColoredPrintf': identifier not found
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3230): error C2065: 'COLOR_GREEN': undeclared identifier
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googletest\src/gtest.cc(3230): fatal error C1003: error count exceeds 100; stopping compilation
[67/402] Building CXX object CMakeFiles\libprotobuf-lite.dir\C_\Projects\_Extern\Source\Google_Protocol_Buffers\src\google\protobuf\generated_enum_util.cc.obj
[68/402] Building CXX object CMakeFiles\libprotobuf-lite.dir\C_\Projects\_Extern\Source\Google_Protocol_Buffers\src\google\protobuf\generated_message_table_driven_lite.cc.obj
[69/402] Building CXX object CMakeFiles\libprotobuf-lite.dir\C_\Projects\_Extern\Source\Google_Protocol_Buffers\src\google\protobuf\io\coded_stream.cc.obj
[70/402] Building CXX object CMakeFiles\libprotobuf-lite.dir\C_\Projects\_Extern\Source\Google_Protocol_Buffers\src\google\protobuf\field_access_listener.cc.obj
[71/402] Building CXX object CMakeFiles\gmock.dir\C_\Projects\_Extern\Source\Google_Protocol_Buffers\third_party\googletest\googlemock\src\gmock-all.cc.obj
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(312): warning C4005: 'MATCHER': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5265): note: see previous definition of 'MATCHER'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(365): warning C4005: 'MATCHER_P': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5268): note: see previous definition of 'MATCHER_P'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(424): warning C4005: 'MATCHER_P2': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5270): note: see previous definition of 'MATCHER_P2'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(486): warning C4005: 'MATCHER_P3': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5272): note: see previous definition of 'MATCHER_P3'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(558): warning C4005: 'MATCHER_P4': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5274): note: see previous definition of 'MATCHER_P4'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(634): warning C4005: 'MATCHER_P5': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5277): note: see previous definition of 'MATCHER_P5'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(713): warning C4005: 'MATCHER_P6': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5280): note: see previous definition of 'MATCHER_P6'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(801): warning C4005: 'MATCHER_P7': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5283): note: see previous definition of 'MATCHER_P7'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(895): warning C4005: 'MATCHER_P8': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5286): note: see previous definition of 'MATCHER_P8'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(993): warning C4005: 'MATCHER_P9': macro redefinition
C:\Projects\ Extern\Microsoft Visual C++ 2019\x64 Debug\include\gmock/gmock-matchers.h(5289): note: see previous definition of 'MATCHER_P9'
C:\Projects\ Extern\Source\Google Protocol Buffers\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h(1098): warning C4005: 'MATCHER_P10': macro redefinition
```
acozzette pushed a commit that referenced this issue Jul 8, 2021
* fix #7074 Safely handle setlocale

`setlocale` returns a pointer to a buffer containing the current locale name.
This needs to be copied into a `std::string` or it will be overwritten by the next call.

Trying to call `setlocale` with a non-null, invalid pointer can have unpredictable results, such as
```
[ RUN      ] StringPrintfTest.Multibyte
minkernel\crts\ucrt\src\appcrt\convert\mbstowcs.cpp(246) : Assertion failed: (pwcs == nullptr && sizeInWords == 0) || (pwcs != nullptr && sizeInWords > 0)
```

`setlocale` can also return a `nullptr` if it fails, but we assert against that.

* stringprintf_unittest.cc: Replace `new char[n+1]` with `std::array`

Prefer safer alternative to naked pointers.

This is a follow-up to 1dd313c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant