yhirose / cpp-peglib

A single file C++ header-only PEG (Parsing Expression Grammars) library
MIT License
916 stars 113 forks source link

MSVC warning about funky characters. #258

Closed gamagan closed 1 year ago

gamagan commented 1 year ago

Hello,

With the latest version as of this writing, 6685012, which is the only one I've tried, I get the following warning on latest MSVC.

The funky chars: \u2502 │ \u250C ┌ \u2514 └o └x

peglib.h(4687,21): warning C4566: character represented by universal-character-name '\u2502' cannot be represented in the current code page (1252)

peglib.h(4696,65): warning C4566: ... '\u250C' ...
peglib.h(4707,21): warning C4566: ... '\u2502' ...
peglib.h(4709,53): warning C4566: ... '\u2514' ...
peglib.h(4709,63): warning C4566: ... '\u2514' ...
yhirose commented 1 year ago

@gamagan, thanks for the report. I just tested it on my machine, but I am not able to reproduce the issue. I get no warning from the VC++ compiler. Here is what I did:

git https://github.com/yhirose/cpp-peglib
mkdir build
cd build
cmake ..
msbuild cpp-peglib.sln

Here is the log when compiling example/calc.cc.

Project "C:\Projects\cpp-peglib\build\ALL_BUILD.vcxproj.metaproj" (2) is building "C:\Projects\cpp-peglib\build\example\calc.vcxproj
.metaproj" (4) on node 1 (default targets).
Project "C:\Projects\cpp-peglib\build\example\calc.vcxproj.metaproj" (4) is building "C:\Projects\cpp-peglib\build\example\calc.vcxp
roj" (5) on node 1 (default targets).
PrepareForBuild:
  Creating directory "calc.dir\Debug\".
  Creating directory "C:\Projects\cpp-peglib\build\example\Debug\".
  Creating directory "calc.dir\Debug\calc.tlog\".
InitializeBuildStatus:
  Creating "calc.dir\Debug\calc.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Projects/cpp-peglib/example/CMakeLists.txt
ClCompile:
  C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\CL.exe /c /I"C:\Projects\cpp-peg
  lib\example\.." /Zi /nologo /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D _CRT_SECURE_NO_DEPRECATE /D "CM
  AKE_INTDIR=\"Debug\"" /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /std:c++17 /Fo"calc.dir\Debug\
  \" /Fd"calc.dir\Debug\vc143.pdb" /external:W3 /Gd /TP /errorReport:queue  /Zc:__cplusplus /utf-8 "C:\Projects\cpp-peglib\example\c
  alc.cc"
  calc.cc
Link:
  C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT
  :"C:\Projects\cpp-peglib\build\example\Debug\calc.exe" /INCREMENTAL /ILK:"calc.dir\Debug\calc.ilk" /NOLOGO kernel32.lib user32.lib
   gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInv
  oker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Projects/cpp-peglib/build/example/Debug/calc.pdb" /SUBSYSTEM:CONSOLE /TLBI
  D:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Projects/cpp-peglib/build/example/Debug/calc.lib" /MACHINE:X64  /machine:x64 calc.dir\Debug
  \calc.obj
  calc.vcxproj -> C:\Projects\cpp-peglib\build\example\Debug\calc.exe
FinalizeBuildStatus:
  Deleting file "calc.dir\Debug\calc.tlog\unsuccessfulbuild".
  Touching "calc.dir\Debug\calc.tlog\calc.lastbuildstate".
Done Building Project "C:\Projects\cpp-peglib\build\example\calc.vcxproj" (default targets).

Probably /utf-8 is missing in your project? Hope it helps.