@@ -101,7 +101,7 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
101
101
if (!sourcef )
102
102
{
103
103
LOG_printf (LOG_ERROR , "failed to read %s: %s\n\n" , sourcefn , strerror (errno ));
104
- CO_exit (2 );
104
+ CO_exit (EXIT_FAILURE );
105
105
}
106
106
107
107
frags = FE_sourceProgram (sourcef , sourcefn , /*is_main=*/ !symfn , module_name );
@@ -110,7 +110,7 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
110
110
if (EM_anyErrors )
111
111
{
112
112
LOG_printf (LOG_ERROR , "\n\nfrontend processing failed - exiting.\n" );
113
- CO_exit (3 );
113
+ CO_exit (EXIT_FAILURE );
114
114
}
115
115
116
116
LOG_printf (OPT_get (OPTION_VERBOSE ) ? LOG_INFO : LOG_DEBUG , "\n\nsemantics worked.\n" );
@@ -129,7 +129,7 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
129
129
else
130
130
{
131
131
LOG_printf (LOG_ERROR , "\n** ERROR: failed to write symbol file %s .\n" , symfn );
132
- CO_exit (4 );
132
+ CO_exit (EXIT_FAILURE );
133
133
}
134
134
}
135
135
@@ -164,7 +164,7 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
164
164
if (!RA_regAlloc (frame , body ) || EM_anyErrors )
165
165
{
166
166
LOG_printf (LOG_ERROR , "\n\nregister allocation failed - exiting.\n" );
167
- CO_exit (5 );
167
+ CO_exit (EXIT_FAILURE );
168
168
}
169
169
170
170
CG_procEntryExitAS (frag );
@@ -185,7 +185,7 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
185
185
if (!out )
186
186
{
187
187
LOG_printf (LOG_ERROR , "\n\nfailed to open asm file %s for writing.\n" , asm_gas_fn );
188
- CO_exit (6 );
188
+ CO_exit (EXIT_FAILURE );
189
189
}
190
190
CG_writeASMFile (out , frags , AS_dialect_gas );
191
191
fclose (out );
@@ -197,7 +197,7 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
197
197
if (!out )
198
198
{
199
199
LOG_printf (LOG_ERROR , "\n\nfailed to open asm file %s for writing.\n" , asm_asmpro_fn );
200
- CO_exit (7 );
200
+ CO_exit (EXIT_FAILURE );
201
201
}
202
202
CG_writeASMFile (out , frags , AS_dialect_ASMPro );
203
203
fclose (out );
@@ -209,7 +209,7 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
209
209
if (!out )
210
210
{
211
211
LOG_printf (LOG_ERROR , "\n\nfailed to open asm file %s for writing.\n" , asm_vasm_fn );
212
- CO_exit (8 );
212
+ CO_exit (EXIT_FAILURE );
213
213
}
214
214
CG_writeASMFile (out , frags , AS_dialect_vasm );
215
215
fclose (out );
@@ -245,21 +245,21 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
245
245
U_memstat ();
246
246
247
247
if (!AS_assembleCode (obj , body , expt , frame ))
248
- CO_exit (9 );
248
+ CO_exit (EXIT_FAILURE );
249
249
250
250
break ;
251
251
}
252
252
case CG_stringFrag :
253
253
AS_assembleDataAlign2 (obj );
254
254
if (!AS_assembleString (obj , frag -> u .stringg .label , frag -> u .stringg .str , frag -> u .stringg .msize ))
255
- CO_exit (10 );
255
+ CO_exit (EXIT_FAILURE );
256
256
break ;
257
257
case CG_dataFrag :
258
258
if (!frag -> u .data .size )
259
259
break ;
260
260
AS_assembleDataAlign2 (obj );
261
261
if (!AS_assembleDataLabel (obj , frag -> u .data .label , frag -> u .data .expt , frag -> u .data .ty ))
262
- CO_exit (11 );
262
+ CO_exit (EXIT_FAILURE );
263
263
if (frag -> u .data .init )
264
264
{
265
265
for (CG_dataFragNode n = frag -> u .data .init ; n ; n = n -> next )
@@ -268,7 +268,7 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
268
268
{
269
269
case CG_labelNode :
270
270
if (!AS_assembleDataLabel (obj , n -> u .label , /*expt=*/ FALSE, /*ty=*/ NULL ))
271
- CO_exit (12 );
271
+ CO_exit (EXIT_FAILURE );
272
272
break ;
273
273
case CG_constNode :
274
274
{
@@ -331,14 +331,14 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
331
331
if (EM_anyErrors )
332
332
{
333
333
LOG_printf (LOG_ERROR , "\n\nassembler failed - exiting.\n" );
334
- CO_exit (13 );
334
+ CO_exit (EXIT_FAILURE );
335
335
}
336
336
337
337
if (objfn )
338
338
LI_segmentWriteObjectFile (obj , objfn );
339
339
340
340
if (!binfn )
341
- CO_exit (0 );
341
+ CO_exit (EXIT_FAILURE );
342
342
343
343
/*
344
344
* machine code generation (link phase)
@@ -352,12 +352,12 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
352
352
if (!fObj )
353
353
{
354
354
LOG_printf (LOG_ERROR , "*** ERROR: failed to open startup.o\n\n" );
355
- CO_exit (14 );
355
+ CO_exit (EXIT_FAILURE );
356
356
}
357
357
if (!LI_segmentListReadObjectFile (UP_link , sl , "startup.o" , fObj ))
358
358
{
359
359
fclose (fObj );
360
- CO_exit (15 );
360
+ CO_exit (EXIT_FAILURE );
361
361
}
362
362
fclose (fObj );
363
363
@@ -375,20 +375,20 @@ int CO_compile(string sourcefn, string module_name, string symfn, string objfn,
375
375
if (!fObj )
376
376
{
377
377
LOG_printf (LOG_ERROR , "*** ERROR: failed to open %s\n\n" , mod_fn );
378
- CO_exit (16 );
378
+ CO_exit (EXIT_FAILURE );
379
379
}
380
380
if (!LI_segmentListReadObjectFile (UP_link , sl , S_name (n -> m -> name ), fObj ))
381
381
{
382
382
fclose (fObj );
383
- CO_exit (17 );
383
+ CO_exit (EXIT_FAILURE );
384
384
}
385
385
fclose (fObj );
386
386
}
387
387
388
388
if (!LI_link (UP_link , sl ))
389
389
{
390
390
LOG_printf (LOG_ERROR , "*** ERROR: failed to link.\n\n" );
391
- CO_exit (18 );
391
+ CO_exit (EXIT_FAILURE );
392
392
}
393
393
394
394
LI_segmentListWriteLoadFile (sl , binfn );
0 commit comments