onnxruntime/include/onnxruntime/core/common
Edward Chen 5a5fec0452
Fix logs getting skipped in single-line conditionals. (#7589)
Fix an issue where a log message got skipped.

A log call like this:
```
LOGS(...) << "message";
```
expands to something like this:
```
if (<output enabled>)
  logging::Capture(...).Stream() << "message";
```

This if statement without brackets is handy for logging arbitrary arguments with the `<<` operator. However, it has other drawbacks like possibly associating with a subsequent `else`.

```
if (cond)
  LOGS(...) << "a";
else
  <do something> // not run when !cond

// equivalently:
if (cond)
  if (<output enabled>)
    logging::Capture(...).Stream() << "a";
  else
    <do something> // not run when !cond
```

Updated the logging macros to handle this case by replacing `if (<enabled>) logging::Capture(...).Stream()` with `if (!<enabled>) {} else logging::Capture(...).Stream()`.

Thanks @tlh20 for the idea for the fix!
2021-05-07 15:40:47 -07:00
..
logging Fix logs getting skipped in single-line conditionals. (#7589) 2021-05-07 15:40:47 -07:00
code_location.h Remove condition from ORT_RETURN_IF[_NOT] macro output. (#6563) 2021-02-05 17:33:29 -08:00
common.h Change onnxruntime::make_unique to std::make_unique (#7502) 2021-04-29 17:04:53 -07:00
const_pointer_container.h
denormal.h Sunghcho/denormals (#5391) 2020-10-15 12:47:42 -07:00
eigen_common_wrapper.h
exceptions.h
make_string.h Make it easier to fold MakeString usages to reduce binary size. (#6754) 2021-02-20 20:41:19 +10:00
optional.h Upgrade optional implementation to https://github.com/martinmoene/optional-lite. (#5563) 2020-11-03 15:27:47 -08:00
parse_string.h Rename MakeString and ParseString functions. (#6272) 2021-01-07 15:43:42 -08:00
spin_pause.h ThreadPool clean up : mm_pause in loops, correctly spin-then-wait, and adopt static methods consistently in the API (#5590) 2020-10-28 09:49:18 +00:00
status.h