Mercurial > sdl-ios-xcode
annotate test/testnativew32.c @ 5130:f2c2f0ecba5f
Fixed bug #1111
kwm@rainbow-runner.nl 2011-01-30 06:28:27 PST
Created attachment 562 [details]
Build fix with clang.
When building sdl 1.2.14 with the Clang compiler http://clang.llvm.org .
The build fails in src/video/mmx.h with the following error:
--------------------------------------------------
./src/video/SDL_RLEaccel.c:831:5: error: invalid operand for instruction
CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
^
./src/video/SDL_RLEaccel.c:831:17: note: instantiated from:
CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
^
./src/video/SDL_RLEaccel.c:831:5: note: instantiated from:
CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
^
./src/video/SDL_RLEaccel.c:647:23: note: instantiated from:
blitter(2, Uint8, ALPHA_BLIT16_565MMX); \
^
./src/video/SDL_RLEaccel.c:282:4: note: instantiated from:
movq_r2m(mm3, *dstp); \
^
In file included from ./src/video/SDL_RLEaccel.c:99:
./src/video/mmx.h:379:28: note: instantiated from:
#define movq_r2m(reg, var) mmx_r2m(movq, reg, var)
^
<scratch space>:192:1: note: instantiated from:
"movq"
^
<inline asm>:1:2: note: instantiated into assembly here
movq %mm3, %dx
^
--------------------------------------------------
According to the clang developers this is a invalid inline assembly.
Using the attached patch from the last commit in the below bug report fixes the
compile.
More details from: http://llvm.org/bugs/show_bug.cgi?id=6730
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 30 Jan 2011 13:42:05 -0800 |
parents | e8916fe9cfc8 |
children |
rev | line source |
---|---|
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 |
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 #include "testnative.h" |
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 |
5062 | 4 #ifdef TEST_NATIVE_WINDOWS |
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 |
5062 | 6 static void *CreateWindowNative(int w, int h); |
7 static void DestroyWindowNative(void *window); | |
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 |
5062 | 9 NativeWindowFactory WindowsWindowFactory = { |
10 "windows", | |
11 CreateWindowNative, | |
12 DestroyWindowNative | |
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 }; |
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
3071 | 15 LRESULT CALLBACK |
16 WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
17 { |
3071 | 18 switch (msg) { |
19 case WM_CLOSE: | |
20 DestroyWindow(hwnd); | |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
21 break; |
3071 | 22 case WM_DESTROY: |
23 PostQuitMessage(0); | |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
24 break; |
3071 | 25 default: |
26 return DefWindowProc(hwnd, msg, wParam, lParam); | |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
27 } |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
28 return 0; |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
29 } |
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 static void * |
5062 | 32 CreateWindowNative(int w, int h) |
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 { |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
34 HWND hwnd; |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
35 WNDCLASS wc; |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
36 |
3071 | 37 wc.style = 0; |
38 wc.lpfnWndProc = WndProc; | |
39 wc.cbClsExtra = 0; | |
40 wc.cbWndExtra = 0; | |
41 wc.hInstance = GetModuleHandle(NULL); | |
42 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); | |
43 wc.hCursor = LoadCursor(NULL, IDC_ARROW); | |
44 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); | |
45 wc.lpszMenuName = NULL; | |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
46 wc.lpszClassName = "SDL Test"; |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
47 |
3071 | 48 if (!RegisterClass(&wc)) { |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
49 MessageBox(NULL, "Window Registration Failed!", "Error!", |
3071 | 50 MB_ICONEXCLAMATION | MB_OK); |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
51 return 0; |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
52 } |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
53 |
3071 | 54 hwnd = |
55 CreateWindow("SDL Test", "", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, | |
56 CW_USEDEFAULT, w, h, NULL, NULL, GetModuleHandle(NULL), | |
57 NULL); | |
58 if (hwnd == NULL) { | |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
59 MessageBox(NULL, "Window Creation Failed!", "Error!", |
3071 | 60 MB_ICONEXCLAMATION | MB_OK); |
3060
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
61 return 0; |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
62 } |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
63 |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
64 ShowWindow(hwnd, SW_SHOW); |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
65 |
4cf533f434d8
Implemented Win32 version of the native window test
Sam Lantinga <slouken@libsdl.org>
parents:
3057
diff
changeset
|
66 return hwnd; |
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 } |
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 |
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 static void |
5062 | 70 DestroyWindowNative(void *window) |
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 { |
3071 | 72 DestroyWindow((HWND) window); |
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 } |
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 |
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 #endif |