casts.c, Windows issues

I'm looking at the remaining failing tests under Windows.

Analysis/casts.c fails on trying to include syslog.h, which is not
present in the Visual Studio include files. The enclosed patch is an
attempt to resolve that by conditionally including WinSock2.h instead,
and resolving issues related to problems including that header.

One issue is the need for the Windows Platform SDK to be added to the
default include paths. This patch includes my former changes to the
default include paths for Windows, plus additional code for adding the
platform SDK. Therefore, you can disregard my previous submissions
regarding InitHeaderSearch.cpp if you use this patch. Also, if anyone
has a better mechanism of finding the Visual Studio and Platform SDK
includes, such as through the registry, please let me know.

A key issue I'll need some feedback on is that I'd like to downgrade
an error on member data declarations in a structure with no name to a
warning. Unfortunately, WinUser.h has a couple of structures like
this:

typedef struct tagMONITORINFOEXA
{
    MONITORINFO;
    CHAR szDevice[CCHDEVICENAME];
} MONITORINFOEXA, *LPMONITORINFOEXA;

Apparently, the nameless declaration is probably a placeholder for
data structure in common with multiple structures. I've put in code
in the patch to check for this case in SemaDecl.cpp, and produce a
warning instead of an error. However, I don't know if the way I did
it is sufficiently specific. Doing so required changing two other
tests, SemaCXX/class.cpp and Sema/decl-invalid.c to accomodate the
message change.

The final key change is to add a couple of default macro definitions
in Targets.cpp to mimic Visual Studio's _M_IX86 and _M_AMD64, to avoid
#error directives in the Windows headers.

Hopefully, this is another step towards getting the Windows headers to compile.

-John

more_win32_stuff.patch (6.61 KB)

I'm looking at the remaining failing tests under Windows.

Analysis/casts.c fails on trying to include syslog.h, which is not
present in the Visual Studio include files. The enclosed patch is an
attempt to resolve that by conditionally including WinSock2.h instead,
and resolving issues related to problems including that header.

This test should just be updated to not use that header, it shouldn't
be necessary.

One issue is the need for the Windows Platform SDK to be added to the
default include paths. This patch includes my former changes to the
default include paths for Windows, plus additional code for adding the
platform SDK. Therefore, you can disregard my previous submissions
regarding InitHeaderSearch.cpp if you use this patch. Also, if anyone
has a better mechanism of finding the Visual Studio and Platform SDK
includes, such as through the registry, please let me know.

A key issue I'll need some feedback on is that I'd like to downgrade
an error on member data declarations in a structure with no name to a
warning. Unfortunately, WinUser.h has a couple of structures like
this:

typedef struct tagMONITORINFOEXA
{
MONITORINFO;
CHAR szDevice[CCHDEVICENAME];
} MONITORINFOEXA, *LPMONITORINFOEXA;

There is more to this, this makes the fields of MONITORINFO available
in this struct. The right fix is to implement this feature under
-fms-extensions. I think that this should be fairly easy, since we
already support the inline case:

This test [cast.c] should just be updated to not use that header, it shouldn't
be necessary.

Okay. I submitted to cfe-commits a patch that just disables the part
of the test that uses the socket stuff. Is this enough, or should I
replace it with something equivalent? I'm just anxious to have the
tests pass on Windows.

One issue is the need for the Windows Platform SDK to be added to the
default include paths. This patch includes my former changes to the
default include paths for Windows, plus additional code for adding the
platform SDK. Therefore, you can disregard my previous submissions
regarding InitHeaderSearch.cpp if you use this patch. Also, if anyone
has a better mechanism of finding the Visual Studio and Platform SDK
includes, such as through the registry, please let me know.

Any comments about this?

There is more to this, this makes the fields of MONITORINFO available
in this struct. The right fix is to implement this feature under
-fms-extensions. I think that this should be fairly easy, since we
already support the inline case:

Oh, sorry, I didn't pick up on this. I can take a whack at this
later, if someone doesn't get to it first. Right now I want to do
something about the failing tests on Windows.

These defines should only be added on Windows, see
WindowsX86_32TargetInfo. Can you submit this part as a separate patch?

I submitted a patch for this to cfe-commits. I guess Win64 is
something for later.

- Daniel

Thanks for reviewing this, Daniel.

This test [cast.c] should just be updated to not use that header, it shouldn't
be necessary.

Okay. I submitted to cfe-commits a patch that just disables the part
of the test that uses the socket stuff. Is this enough, or should I
replace it with something equivalent? I'm just anxious to have the
tests pass on Windows.

The relevant parts of the test should be replaced with something
equivalent. I'll try to bug Ted to look at this today (if I don't
forget).

One issue is the need for the Windows Platform SDK to be added to the
default include paths. This patch includes my former changes to the
default include paths for Windows, plus additional code for adding the
platform SDK. Therefore, you can disregard my previous submissions
regarding InitHeaderSearch.cpp if you use this patch. Also, if anyone
has a better mechanism of finding the Visual Studio and Platform SDK
includes, such as through the registry, please let me know.

Any comments about this?

I didn't look at this revision, you saw my comments on the previous
version I assume?

- Daniel

Somehow I missed this thread.

I’ll correct the test case so that it doesn’t depend on the headers.

John,

Thanks for your patience. I just committed r79511:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090817/020444.html

Does 'test/Analysis/casts.c' now pass on Windows?

Best,
Ted

Ted,

Sorry, I forgot to reply. Yes, casts.c passes on Windows. Thanks!

-John