@@ -426,8 +426,10 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
426426
427427 for (auto &termPair : mapODS) {
428428 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
431433 // malformed term: missing backend -- output ERROR, then continue
432434 logger::error (" ERROR: missing backend, format of filter = "
433435 " '[!]backend:filterStrings'" );
@@ -459,20 +461,19 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
459461 std::tolower (static_cast <unsigned char >(b));
460462 })) {
461463 // 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;
465466 }
466467 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 = "
469470 " '[!]backend:filterStrings'" );
470- continue ;
471+ return UR_RESULT_ERROR_INVALID_VALUE ;
471472 }
472473 if (std::find_if (termPair.second .cbegin (), termPair.second .cend (),
473474 [](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
476477 // malformed term: missing filterString -- output warning, then continue
477478 logger::warning (
478479 " WARNING: empty filterString, format of filterStrings "
@@ -483,10 +484,10 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
483484 [](const auto &s) {
484485 return std::count (s.cbegin (), s.cend (), ' .' ) > 2 ;
485486 }) != 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 ;
490491 }
491492 if (std::find_if (
492493 termPair.second .cbegin (), termPair.second .cend (),
@@ -504,10 +505,9 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
504505 }
505506 return false ; // no BAD things, so must be okay
506507 }) != 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;
511511 }
512512
513513 // TODO -- use regex validation_pattern to catch all other syntax errors in the ODS string
0 commit comments