Little win32/Signals.cpp patch

Adding an include for std::remove under vc7.1

diff.txt (736 Bytes)

But I compiled that under vc7.1 as it was!

Someone needs to adjudicate on whether I add the #include of <cstdio> or
not. I can't test this so, Paolo/Henrik/Jeff, please let me know if I
need to add it.

Thanks,

Reid.

Jeff Cohen wrote:

But I compiled that under vc7.1 as it was!

;-((

Probably is an implicid includes, but I'm using the STLPort standard library for LLVM (because it's not possible to use hash_map and hash_set of microsoft)

cl /nologo /TP /EHsc /GR /Zi /Yd /D__STDC_LIMIT_MACROS /DHAVE__FINITE_IN_FLOAT_H /DHAVE__ISNAN_IN_FLOAT_H /DHAVE_WINDOWS_H /ISTLport-4.6.2\stlport /Illvm\include /Iinclude /Ibuild_vc71\inclu
de /Illvm\include /c llvm\lib\System\Signals.cpp /Fobuild_vc71\lib\System\Signals.obj
Signals.cpp
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(127) : error C2039: 'remove' : is not a member of '_STL'
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(127) : error C3861: 'remove': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(179) : error C2065: 'stderr' : undeclared identifier
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(179) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(182) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(182) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(187) : error C3861: 'fputs': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(187) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(200) : error C3861: 'fputc': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(200) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(206) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(206) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(208) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(208) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(215) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(215) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(217) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(217) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(220) : error C3861: 'fputc': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(220) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup

D:\home\arathorn>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

I added the include of cstudio and it fails with plain VC7.1; the file
does not exist.

Add it for now. If it is impossible to build with VC7.1 and without
STLPort, then there really isn't a choice. I have to research the issue
myself to see if it's possible to avoid using STLPort.

I'll wait for the research. We should try, as much as possible, to make
it work with just what the compiler provides and without third party
packages.

Thanks,

reid.

OK. I strongly support that sentiment.

Paolo, could you send me your procedure for building under Windows? I
haven't tried to build anything but System/Win32 so far.

I checked right now that it compiles also with

#include <iostream>

Jeff, can you test it with plain VC?

<iostream> works.

std::remove is in <algorithm>

<algorithm> works too.

Actually, <algorithm> is not correct. This remove is in stdio.h and
io.h in VC7.1. It removes a file, not elements from a collection.

The proper solution is to not use remove at all and use
Path::destroy_file().

Paulo,

If <algorithm> works for you, I'd rather implement that. Please let me
know.

Reid.

But don't you want to use ::remove instead of std::remove then?

Yes.

I'm currently working on "Block", "File" and "MappedFile" abstractions
for lib/System. When done, these abstractions will take care of the
bulks of the remaining system dependent behavior in LLVM. Unfortunately,
the conversion from the XPS code is somewhat tedious for LLVM standards.
Anyway, hope to do this on the plane tomorrow.

Reid.

It would be great to avoid STLPort and use plain vanilla VC... as I told, the biggest difference it's how the hash_map and hash_set are implemented, but I'm not so strong in C++ for resolving the iussue.

About the build procedure, it's based on scons, and it's still at a very preliminary stage...
Right now I'm trying to build TableGen with it, as till now I've always copied TableGen results from the cygwin build :wink:
Gime me a little more time, as I'm in the middle of this, and then I'll post it to the list.

Jeff Cohen wrote:

<algorithm> works too.

For std::remove yes... but...

d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(179) : error C2065: 'stderr' : undeclared identifier
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(179) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(182) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(182) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(187) : error C3861: 'fputs': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(187) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(200) : error C3861: 'fputc': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(200) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(206) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(206) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(208) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(208) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(215) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(215) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(217) : error C3861: 'fprintf': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(217) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(220) : error C3861: 'fputc': identifier not found, even with argument-dependent lookup
d:\home\arathorn\sandbox\llvm\llvm\lib\System\platform\Signals.cpp(220) : error C3861: 'stderr': identifier not found, even with argument-dependent lookup

These should all be prepended with ::, methinks, to label them as coming
from the global namespace...

For one, as example I'm seeing the following in Unix/Path.cpp:

  int fd = ::creat(path.c_str(), S_IRUSR | S_IWUSR);

You are correct. This is a bug and is also present in the generic Unix
version. Using Path::destroy_file fixes that also.

The compiler is not finding them anywhere. If they were in the global
namespace they'd be found even without ::. What :: does is force the
compiler to ignore definitions in other scopes that would take
precedence over the global namespace. But if there were any such
(incorrect) definitions being found, it would not be giving a "not
found" error.

The best solution for now is to include <iostream> and replace
std::remove() with Path::destroy_file().