@@ -426,8 +426,10 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
426
426
427
427
for (auto &termPair : mapODS) {
428
428
std::string backend = termPair.first ;
429
- if (backend
430
- .empty ()) { // FIXME: never true because getenv_to_map rejects this case
429
+ // TODO: Figure out how to process all ODS errors rather than returning
430
+ // on the first error.
431
+ if (backend.empty ()) {
432
+ // FIXME: never true because getenv_to_map rejects this case
431
433
// malformed term: missing backend -- output ERROR, then continue
432
434
logger::error (" ERROR: missing backend, format of filter = "
433
435
" '[!]backend:filterStrings'" );
@@ -459,20 +461,19 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
459
461
std::tolower (static_cast <unsigned char >(b));
460
462
})) {
461
463
// irrelevant term for current request: different backend -- silently ignore
462
- logger::warning (
463
- " WARNING: ignoring term with irrelevant backend '{}'" , backend);
464
- continue ;
464
+ logger::error (" unrecognised backend '{}'" , backend);
465
+ return UR_RESULT_ERROR_INVALID_VALUE;
465
466
}
466
467
if (termPair.second .size () == 0 ) {
467
- // malformed term: missing filterStrings -- output ERROR, then continue
468
- logger::error (" ERROR missing filterStrings, format of filter = "
468
+ // malformed term: missing filterStrings -- output ERROR
469
+ logger::error (" missing filterStrings, format of filter = "
469
470
" '[!]backend:filterStrings'" );
470
- continue ;
471
+ return UR_RESULT_ERROR_INVALID_VALUE ;
471
472
}
472
473
if (std::find_if (termPair.second .cbegin (), termPair.second .cend (),
473
474
[](const auto &s) { return s.empty (); }) !=
474
- termPair.second
475
- . cend ()) { // FIXME: never true because getenv_to_map rejects this case
475
+ termPair.second . cend ()) {
476
+ // FIXME: never true because getenv_to_map rejects this case
476
477
// malformed term: missing filterString -- output warning, then continue
477
478
logger::warning (
478
479
" WARNING: empty filterString, format of filterStrings "
@@ -483,10 +484,10 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
483
484
[](const auto &s) {
484
485
return std::count (s.cbegin (), s.cend (), ' .' ) > 2 ;
485
486
}) != termPair.second .cend ()) {
486
- // malformed term: too many dots in filterString -- output warning, then continue
487
- logger::warning ( " WARNING: too many dots in filterString, format of "
488
- " filterString = 'root[.sub[.subsub]]'" );
489
- continue ;
487
+ // malformed term: too many dots in filterString
488
+ logger::error ( " too many dots in filterString, format of "
489
+ " filterString = 'root[.sub[.subsub]]'" );
490
+ return UR_RESULT_ERROR_INVALID_VALUE ;
490
491
}
491
492
if (std::find_if (
492
493
termPair.second .cbegin (), termPair.second .cend (),
@@ -504,10 +505,9 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
504
505
}
505
506
return false ; // no BAD things, so must be okay
506
507
}) != termPair.second .cend ()) {
507
- // malformed term: star dot no-star in filterString -- output warning, then continue
508
- logger::warning (
509
- " WARNING: invalid wildcard in filterString, '*.' => '*.*'" );
510
- continue ;
508
+ // malformed term: star dot no-star in filterString
509
+ logger::error (" invalid wildcard in filterString, '*.' => '*.*'" );
510
+ return UR_RESULT_ERROR_INVALID_VALUE;
511
511
}
512
512
513
513
// TODO -- use regex validation_pattern to catch all other syntax errors in the ODS string
0 commit comments