@@ -309,8 +309,11 @@ hwloc_calc_append_object_range(struct hwloc_calc_location_context_s *lcontext,
309
309
& first , & amount , & step , & wrap ,
310
310
& dot ,
311
311
verbose );
312
- if (err < 0 )
312
+ if (err < 0 ) {
313
+ if (verbose >= 0 )
314
+ fprintf (stderr , "Failed to parse object index range %s\n" , string );
313
315
return -1 ;
316
+ }
314
317
assert (amount != -1 || !wrap );
315
318
316
319
if (dot ) {
@@ -319,15 +322,26 @@ hwloc_calc_append_object_range(struct hwloc_calc_location_context_s *lcontext,
319
322
hwloc_obj_type_t type ;
320
323
const char * nextstring = dot + 1 ;
321
324
typelen = strspn (nextstring , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" );
322
- if (!typelen || nextstring [typelen ] != ':' )
325
+ if (!typelen || nextstring [typelen ] != ':' ) {
326
+ if (verbose >= 0 )
327
+ fprintf (stderr , "hierarchical sublocation %s contains types not followed by colon and index range\n" , nextstring );
323
328
return -1 ;
329
+ }
324
330
nextsep = & nextstring [typelen ];
325
331
326
332
nextdepth = hwloc_calc_parse_depth_prefix (lcontext ,
327
333
nextstring , typelen ,
328
334
& type );
329
- if (nextdepth == HWLOC_TYPE_DEPTH_UNKNOWN || nextdepth == HWLOC_TYPE_DEPTH_MULTIPLE )
335
+ if (nextdepth == HWLOC_TYPE_DEPTH_UNKNOWN ) {
336
+ if (verbose >= 0 )
337
+ fprintf (stderr , "could not find level specified by location %s\n" , nextstring );
338
+ return -1 ;
339
+ }
340
+ if (nextdepth == HWLOC_TYPE_DEPTH_MULTIPLE ) {
341
+ if (verbose >= 0 )
342
+ fprintf (stderr , "found multiple levels for location %s\n" , nextstring );
330
343
return -1 ;
344
+ }
331
345
/* we need an object with a cpuset, that's depth>=0 or memory */
332
346
if (nextdepth < 0 && nextdepth != HWLOC_TYPE_DEPTH_NUMANODE ) {
333
347
if (verbose >= 0 )
@@ -480,8 +494,11 @@ hwloc_calc_append_iodev_by_index(struct hwloc_calc_location_context_s *lcontext,
480
494
fprintf (stderr , "hierarchical location %s only supported with normal object types\n" , string );
481
495
return -1 ;
482
496
}
483
- if (err < 0 )
497
+ if (err < 0 ) {
498
+ if (verbose >= 0 )
499
+ fprintf (stderr , "Failed to parse object index range %s\n" , current );
484
500
return -1 ;
501
+ }
485
502
}
486
503
487
504
max = hwloc_get_nbobjs_by_depth (topology , depth );
@@ -546,10 +563,18 @@ hwloc_calc_process_location(struct hwloc_calc_location_context_s *lcontext,
546
563
depth = hwloc_calc_parse_depth_prefix (lcontext ,
547
564
arg , typelen ,
548
565
& type );
549
- if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE ) {
566
+ if (depth == HWLOC_TYPE_DEPTH_UNKNOWN ) {
567
+ if (verbose >= 0 )
568
+ fprintf (stderr , "could not find level specified by location %s\n" , arg );
550
569
return -1 ;
570
+ }
571
+ if (depth == HWLOC_TYPE_DEPTH_MULTIPLE ) {
572
+ if (verbose >= 0 )
573
+ fprintf (stderr , "found multiple levels for location %s\n" , arg );
574
+ return -1 ;
575
+ }
551
576
552
- } else if (depth < 0 && depth != HWLOC_TYPE_DEPTH_NUMANODE ) {
577
+ if (depth < 0 && depth != HWLOC_TYPE_DEPTH_NUMANODE ) {
553
578
/* special object without cpusets */
554
579
555
580
/* if we didn't find a depth but found a type, handle special cases */
0 commit comments