@@ -195,7 +195,8 @@ hwloc_calc_parse_depth_prefix(struct hwloc_calc_location_context_s *lcontext,
195
195
static __hwloc_inline int
196
196
hwloc_calc_parse_range (const char * _string ,
197
197
int * firstp , int * amountp , int * stepp , int * wrapp ,
198
- const char * * dotp )
198
+ const char * * dotp ,
199
+ int verbose )
199
200
{
200
201
char string [65 ];
201
202
size_t len ;
@@ -211,7 +212,8 @@ hwloc_calc_parse_range(const char *_string,
211
212
len = strlen (_string );
212
213
}
213
214
if (len >= sizeof (string )) {
214
- fprintf (stderr , "invalid range `%s', too long\n" , _string );
215
+ if (verbose >= 0 )
216
+ fprintf (stderr , "invalid range `%s', too long\n" , _string );
215
217
return -1 ;
216
218
}
217
219
memcpy (string , _string , len );
@@ -237,7 +239,8 @@ hwloc_calc_parse_range(const char *_string,
237
239
* wrapp = 0 ;
238
240
return 0 ;
239
241
} else {
240
- fprintf (stderr , "unrecognized range keyword `%s'\n" , string );
242
+ if (verbose >= 0 )
243
+ fprintf (stderr , "unrecognized range keyword `%s'\n" , string );
241
244
return -1 ;
242
245
}
243
246
}
@@ -249,7 +252,8 @@ hwloc_calc_parse_range(const char *_string,
249
252
if (* end == '-' ) {
250
253
last = strtol (end + 1 , & end2 , 10 );
251
254
if (* end2 ) {
252
- fprintf (stderr , "invalid character at `%s' after range at `%s'\n" , end2 , string );
255
+ if (verbose >= 0 )
256
+ fprintf (stderr , "invalid character at `%s' after range at `%s'\n" , end2 , string );
253
257
return -1 ;
254
258
} else if (end2 == end + 1 ) {
255
259
/* X- */
@@ -264,15 +268,18 @@ hwloc_calc_parse_range(const char *_string,
264
268
wrap = 1 ;
265
269
amount = strtol (end + 1 , & end2 , 10 );
266
270
if (* end2 ) {
267
- fprintf (stderr , "invalid character at `%s' after range at `%s'\n" , end2 , string );
271
+ if (verbose >= 0 )
272
+ fprintf (stderr , "invalid character at `%s' after range at `%s'\n" , end2 , string );
268
273
return -1 ;
269
274
} else if (end2 == end + 1 ) {
270
- fprintf (stderr , "missing width at `%s' in range at `%s'\n" , end2 , string );
275
+ if (verbose >= 0 )
276
+ fprintf (stderr , "missing width at `%s' in range at `%s'\n" , end2 , string );
271
277
return -1 ;
272
278
}
273
279
274
280
} else if (* end ) {
275
- fprintf (stderr , "invalid character at `%s' after index at `%s'\n" , end , string );
281
+ if (verbose >= 0 )
282
+ fprintf (stderr , "invalid character at `%s' after index at `%s'\n" , end , string );
276
283
return -1 ;
277
284
}
278
285
@@ -300,7 +307,8 @@ hwloc_calc_append_object_range(struct hwloc_calc_location_context_s *lcontext,
300
307
301
308
err = hwloc_calc_parse_range (string ,
302
309
& first , & amount , & step , & wrap ,
303
- & dot );
310
+ & dot ,
311
+ verbose );
304
312
if (err < 0 )
305
313
return -1 ;
306
314
assert (amount != -1 || !wrap );
@@ -466,7 +474,8 @@ hwloc_calc_append_iodev_by_index(struct hwloc_calc_location_context_s *lcontext,
466
474
current ++ ;
467
475
err = hwloc_calc_parse_range (current ,
468
476
& first , & amount , & step , & wrap ,
469
- & dot );
477
+ & dot ,
478
+ verbose );
470
479
if (dot ) {
471
480
fprintf (stderr , "hierarchical location %s only supported with normal object types\n" , string );
472
481
return -1 ;
0 commit comments