]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Sample/Tools/Source/VcCheck/VcCheck.c
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / VcCheck / VcCheck.c
1 /*++
2
3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 VcCheck.c
15
16 Abstract:
17
18 We have found problems with the Visual C++ SP4 and the /O1 flag.
19 If this tests ask a question you have the wrong version of Visual C++
20 on your system
21
22 This test assumes the tools are being compiled with the same complier
23 as the Tiano code.
24
25 Please see $(EFI_SOURCE)\EFI2.0 Developer's Manual.doc to get the
26 correct version of Visual C++
27
28 --*/
29
30 #include <stdio.h>
31
32 _int16 gGloba16;
33
34 int
35 CheckLostCode (
36 int Value
37 )
38 /*++
39
40 Routine Description:
41 This routine is used to test for compiler isseus with /O1.
42 If the /O1 compiler option, and C2.dll is got from Visual C++ SP5
43 (version: 6.00.8168.0), the assember codes after default branch will be
44 losted. (Execute "cl Visual Ccheck.c /O1 /FAsc" to get detail information)
45
46 Arguments:
47 Value - Test case
48
49 Returns:
50 Test to see if comiler error is present.
51
52 --*/
53 {
54 switch (Value) {
55 case 0:
56 break;
57
58 default:
59 _asm
60 {
61 mov bx, 1
62 mov gGloba16, bx
63 }
64
65 return 1;
66 }
67
68 _asm
69 {
70 mov bx, 0
71 mov gGloba16, bx
72 }
73
74 return 0;
75 }
76
77 int
78 main (
79 void
80 )
81 /*++
82
83 Routine Description:
84 This utility is checking for a known Visual C++ compiler issues. To remove this
85 question from the build follow the steps in the developers manual.
86
87 Arguments:
88 NONE
89
90 Returns:
91 0 - Compiler version is O.K.
92 1 - Compiler version is Bad
93
94 --*/
95 {
96 int result;
97 char select;
98
99 gGloba16 = 0xFF;
100 result = 0;
101
102 CheckLostCode (0);
103 result += (gGloba16 == 0) ? 0 : 1;
104
105 CheckLostCode (1);
106 result += (gGloba16 == 1) ? 0 : 1;
107
108 if (result != 0) {
109 printf ("Warning: C2.dll is incorrect.\n Please see $(EFI_SOURCE)\\EFI2.0 Developer's Manual.doc for corrective action.\n");
110 printf ("Would you want to continue?(Y/N)");
111
112 scanf ("%c", &select);
113 if ((select == 'Y') || (select == 'y')) {
114 return 0;
115 } else {
116 return 1;
117 }
118 }
119
120 return 0;
121 }