Skip to content

Commit c5658a0

Browse files
committed
Suppress compiler warnings in ecpg test on newer Windows toolchains.
nan_test.pgc supposed that it could unconditionally #define isnan() and isinf() on WIN32. This was evidently copied at some point from src/include/port/win32.h, but nowadays there's a test on _MSC_VER there. Make nan_test.pgc look the same. Per buildfarm warnings. There's no evidence this produces anything worse than a warning, and besides it's only a test case, so I don't feel a need to back-patch.
1 parent 41c16ed commit c5658a0

File tree

3 files changed

+231
-227
lines changed

3 files changed

+231
-227
lines changed

src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626

2727

2828
#ifdef WIN32
29+
#if (_MSC_VER < 1800)
2930
#define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) || (_fpclass(x) == _FPCLASS_NINF))
3031
#define isnan(x) _isnan(x)
32+
#endif
3133
#endif /* WIN32 */
3234

3335
int
@@ -39,54 +41,54 @@ main(void)
3941

4042

4143

42-
#line 19 "nan_test.pgc"
44+
#line 21 "nan_test.pgc"
4345
int id ;
4446

45-
#line 20 "nan_test.pgc"
47+
#line 22 "nan_test.pgc"
4648
double d ;
4749

48-
#line 21 "nan_test.pgc"
50+
#line 23 "nan_test.pgc"
4951
numeric * num ;
5052

51-
#line 22 "nan_test.pgc"
53+
#line 24 "nan_test.pgc"
5254
char val [ 16 ] ;
5355
/* exec sql end declare section */
54-
#line 23 "nan_test.pgc"
56+
#line 25 "nan_test.pgc"
5557

5658

5759
ECPGdebug(1, stderr);
5860
/* exec sql whenever sqlerror do sqlprint ( ) ; */
59-
#line 26 "nan_test.pgc"
61+
#line 28 "nan_test.pgc"
6062

6163

6264
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
63-
#line 28 "nan_test.pgc"
65+
#line 30 "nan_test.pgc"
6466

6567
if (sqlca.sqlcode < 0) sqlprint ( );}
66-
#line 28 "nan_test.pgc"
68+
#line 30 "nan_test.pgc"
6769

6870

6971
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table nantest1 ( id int4 , d float8 )", ECPGt_EOIT, ECPGt_EORT);
70-
#line 30 "nan_test.pgc"
72+
#line 32 "nan_test.pgc"
7173

7274
if (sqlca.sqlcode < 0) sqlprint ( );}
73-
#line 30 "nan_test.pgc"
75+
#line 32 "nan_test.pgc"
7476

7577
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest1 ( id , d ) values ( 1 , 'nan' :: float8 ) , ( 2 , 'infinity' :: float8 ) , ( 3 , '-infinity' :: float8 )", ECPGt_EOIT, ECPGt_EORT);
76-
#line 31 "nan_test.pgc"
78+
#line 33 "nan_test.pgc"
7779

7880
if (sqlca.sqlcode < 0) sqlprint ( );}
79-
#line 31 "nan_test.pgc"
81+
#line 33 "nan_test.pgc"
8082

8183

8284
/* declare cur cursor for select id , d , d from nantest1 */
83-
#line 33 "nan_test.pgc"
85+
#line 35 "nan_test.pgc"
8486

8587
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
86-
#line 34 "nan_test.pgc"
88+
#line 36 "nan_test.pgc"
8789

8890
if (sqlca.sqlcode < 0) sqlprint ( );}
89-
#line 34 "nan_test.pgc"
91+
#line 36 "nan_test.pgc"
9092

9193
while (1)
9294
{
@@ -97,10 +99,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
9799
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
98100
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
99101
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
100-
#line 37 "nan_test.pgc"
102+
#line 39 "nan_test.pgc"
101103

102104
if (sqlca.sqlcode < 0) sqlprint ( );}
103-
#line 37 "nan_test.pgc"
105+
#line 39 "nan_test.pgc"
104106

105107
if (sqlca.sqlcode)
106108
break;
@@ -114,34 +116,34 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
114116
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
115117
ECPGt_double,&(d),(long)1,(long)1,sizeof(double),
116118
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
117-
#line 45 "nan_test.pgc"
119+
#line 47 "nan_test.pgc"
118120

119121
if (sqlca.sqlcode < 0) sqlprint ( );}
120-
#line 45 "nan_test.pgc"
122+
#line 47 "nan_test.pgc"
121123

122124
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest1 ( id , d ) values ( $1 + 6 , $2 )",
123125
ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
124126
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
125127
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
126128
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
127-
#line 46 "nan_test.pgc"
129+
#line 48 "nan_test.pgc"
128130

129131
if (sqlca.sqlcode < 0) sqlprint ( );}
130-
#line 46 "nan_test.pgc"
132+
#line 48 "nan_test.pgc"
131133

132134
}
133135
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur", ECPGt_EOIT, ECPGt_EORT);
134-
#line 48 "nan_test.pgc"
136+
#line 50 "nan_test.pgc"
135137

136138
if (sqlca.sqlcode < 0) sqlprint ( );}
137-
#line 48 "nan_test.pgc"
139+
#line 50 "nan_test.pgc"
138140

139141

140142
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select id , d , d from nantest1", ECPGt_EOIT, ECPGt_EORT);
141-
#line 50 "nan_test.pgc"
143+
#line 52 "nan_test.pgc"
142144

143145
if (sqlca.sqlcode < 0) sqlprint ( );}
144-
#line 50 "nan_test.pgc"
146+
#line 52 "nan_test.pgc"
145147

146148
while (1)
147149
{
@@ -152,10 +154,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
152154
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
153155
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
154156
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
155-
#line 53 "nan_test.pgc"
157+
#line 55 "nan_test.pgc"
156158

157159
if (sqlca.sqlcode < 0) sqlprint ( );}
158-
#line 53 "nan_test.pgc"
160+
#line 55 "nan_test.pgc"
159161

160162
if (sqlca.sqlcode)
161163
break;
@@ -165,25 +167,25 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
165167
printf("%d NaN '%s'\n", id, val);
166168
}
167169
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur", ECPGt_EOIT, ECPGt_EORT);
168-
#line 61 "nan_test.pgc"
170+
#line 63 "nan_test.pgc"
169171

170172
if (sqlca.sqlcode < 0) sqlprint ( );}
171-
#line 61 "nan_test.pgc"
173+
#line 63 "nan_test.pgc"
172174

173175

174176
num = PGTYPESnumeric_new();
175177

176178
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table nantest2 ( id int4 , d numeric )", ECPGt_EOIT, ECPGt_EORT);
177-
#line 65 "nan_test.pgc"
179+
#line 67 "nan_test.pgc"
178180

179181
if (sqlca.sqlcode < 0) sqlprint ( );}
180-
#line 65 "nan_test.pgc"
182+
#line 67 "nan_test.pgc"
181183

182184
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest2 ( id , d ) values ( 4 , 'nan' :: numeric )", ECPGt_EOIT, ECPGt_EORT);
183-
#line 66 "nan_test.pgc"
185+
#line 68 "nan_test.pgc"
184186

185187
if (sqlca.sqlcode < 0) sqlprint ( );}
186-
#line 66 "nan_test.pgc"
188+
#line 68 "nan_test.pgc"
187189

188190

189191
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select id , d , d from nantest2 where id = 4", ECPGt_EOIT,
@@ -193,39 +195,39 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
193195
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
194196
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
195197
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
196-
#line 68 "nan_test.pgc"
198+
#line 70 "nan_test.pgc"
197199

198200
if (sqlca.sqlcode < 0) sqlprint ( );}
199-
#line 68 "nan_test.pgc"
201+
#line 70 "nan_test.pgc"
200202

201203

202204
printf("%d %s '%s'\n", id, (num->sign == NUMERIC_NAN ? "NaN" : "not NaN"), val);
203205

204206
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest2 ( id , d ) values ( 5 , $1 )",
205207
ECPGt_numeric,&(num),(long)1,(long)0,sizeof(numeric),
206208
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
207-
#line 72 "nan_test.pgc"
209+
#line 74 "nan_test.pgc"
208210

209211
if (sqlca.sqlcode < 0) sqlprint ( );}
210-
#line 72 "nan_test.pgc"
212+
#line 74 "nan_test.pgc"
211213

212214
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into nantest2 ( id , d ) values ( 6 , $1 )",
213215
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
214216
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
215-
#line 73 "nan_test.pgc"
217+
#line 75 "nan_test.pgc"
216218

217219
if (sqlca.sqlcode < 0) sqlprint ( );}
218-
#line 73 "nan_test.pgc"
220+
#line 75 "nan_test.pgc"
219221

220222

221223
/* declare cur1 cursor for select id , d , d from nantest2 */
222-
#line 75 "nan_test.pgc"
224+
#line 77 "nan_test.pgc"
223225

224226
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur1 cursor for select id , d , d from nantest2", ECPGt_EOIT, ECPGt_EORT);
225-
#line 76 "nan_test.pgc"
227+
#line 78 "nan_test.pgc"
226228

227229
if (sqlca.sqlcode < 0) sqlprint ( );}
228-
#line 76 "nan_test.pgc"
230+
#line 78 "nan_test.pgc"
229231

230232
while (1)
231233
{
@@ -236,35 +238,35 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
236238
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
237239
ECPGt_char,(val),(long)16,(long)1,(16)*sizeof(char),
238240
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
239-
#line 79 "nan_test.pgc"
241+
#line 81 "nan_test.pgc"
240242

241243
if (sqlca.sqlcode < 0) sqlprint ( );}
242-
#line 79 "nan_test.pgc"
244+
#line 81 "nan_test.pgc"
243245

244246
if (sqlca.sqlcode)
245247
break;
246248
printf("%d %s '%s'\n", id, (num->sign == NUMERIC_NAN ? "NaN" : "not NaN"), val);
247249
}
248250
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur1", ECPGt_EOIT, ECPGt_EORT);
249-
#line 84 "nan_test.pgc"
251+
#line 86 "nan_test.pgc"
250252

251253
if (sqlca.sqlcode < 0) sqlprint ( );}
252-
#line 84 "nan_test.pgc"
254+
#line 86 "nan_test.pgc"
253255

254256

255257
PGTYPESnumeric_free(num);
256258

257259
{ ECPGtrans(__LINE__, NULL, "rollback");
258-
#line 88 "nan_test.pgc"
260+
#line 90 "nan_test.pgc"
259261

260262
if (sqlca.sqlcode < 0) sqlprint ( );}
261-
#line 88 "nan_test.pgc"
263+
#line 90 "nan_test.pgc"
262264

263265
{ ECPGdisconnect(__LINE__, "CURRENT");
264-
#line 89 "nan_test.pgc"
266+
#line 91 "nan_test.pgc"
265267

266268
if (sqlca.sqlcode < 0) sqlprint ( );}
267-
#line 89 "nan_test.pgc"
269+
#line 91 "nan_test.pgc"
268270

269271

270272
return (0);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy