zhujingguang / pdfium

Automatically exported from code.google.com/p/pdfium
0 stars 0 forks source link

compile broken at head on Windows #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
At head

fxge currently removes NOMINMAX from defines in pdfium.gyp

safe_conversions_impl added recently uses numeric_limits::max() and 
numeric_limits::min() resulting in errors like

e:\b\build\slave\win\build\src\third_party\pdfium\third_party\numerics\safe_conv
ersions_impl.h(152) : error C2220: warning treated as error - no 'object' file 
generated
e:\b\build\slave\win\build\src\third_party\pdfium\third_party\numerics\safe_conv
ersions_impl.h(152) : warning C4003: not enough actual parameters for macro 
'max'
e:\b\build\slave\win\build\src\third_party\pdfium\third_party\numerics\safe_conv
ersions_impl.h(153) : warning C4003: not enough actual parameters for macro 
'max'

Removing the undef of NOMINXMAX results in

FAILED: ninja -t msvc -e environment.x86 -- 
"d:\src\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo 
/showIncludes /FC 
@obj\third_party\pdfium\core\src\fxge\win32\fxge.fx_win32_gdipext.obj.rsp /c 
..\..\third_party\pdfium\core\src\fxge\win32\fx_win32_gdipext.cpp 
/Foobj\third_party\pdfium\core\src\fxge\win32\fxge.fx_win32_gdipext.obj 
/Fdobj\third_party\pdfium\fxge.cc.pdb
d:\src\depot_tools\win_toolchain\vs2013_files\win8sdk\include\um\gdiplustypes.h(
475) : error C3861: 'min': identifier not found
d:\src\depot_tools\win_toolchain\vs2013_files\win8sdk\include\um\gdiplustypes.h(
476) : error C3861: 'min': identifier not found

so one or the other is going to need to be changed.

Original issue reported on code.google.com by scottmg@chromium.org on 31 Jul 2014 at 11:55

GoogleCodeExporter commented 9 years ago
It appears to be non-trivial to use #undef to work around this because usage of 
gdiplustypes and safe_conversions_impl are mixed into the same translation 
units.

Original comment by scottmg@chromium.org on 1 Aug 2014 at 12:01

GoogleCodeExporter commented 9 years ago
palmer, can that file not use min/max for now? (This is blocking rolling pdfium)

Original comment by thakis@chromium.org on 1 Aug 2014 at 12:04

GoogleCodeExporter commented 9 years ago
I don't trust myself to hack in a "fix" for this. Tom or Justin?

Original comment by pal...@chromium.org on 1 Aug 2014 at 12:33

GoogleCodeExporter commented 9 years ago
Yet another reason to get rid of that damn GDI dependency! But in the interim, 
it looks like the sub includes are all wrapped inside the GDIplus namespace. 
So, declaring the following prior to including gdiplus.h would probably work:

namespace Gdiplus
{
  using std::min;
  using std::max;
}

Lets see if I can check out the build and try it.

Original comment by jschuh@chromium.org on 1 Aug 2014 at 4:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Okay, the simple attached patch works. I'd clean it up myself and land it, but 
I don't know how that works in this repo.

Original comment by jschuh@chromium.org on 1 Aug 2014 at 5:01

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks Justin, https://codereview.chromium.org/438843003

Original comment by scottmg@chromium.org on 1 Aug 2014 at 5:11

GoogleCodeExporter commented 9 years ago
(I can't mark this fixed, but it is.)

Original comment by scottmg@chromium.org on 1 Aug 2014 at 7:40

GoogleCodeExporter commented 9 years ago

Original comment by thakis@chromium.org on 1 Aug 2014 at 11:25