https://github.com/Project-OSRM/osrm-backend/pull/2685/files fixes an issue where we did elongate(fstStep, sndStep); instead of newStep = elongate(fstStep, sndStep); we didn't get any warnings. The only way to trigger a warning here is to use ```cpp __attribute__((warn_unused_result)) ``` This changeset does exactly that: for the new guidance code prone to these kind of issue we add such an attribute to the declaration.
16 lines
364 B
C++
16 lines
364 B
C++
#ifndef OSRM_ATTRIBUTES_HPP_
|
|
#define OSRM_ATTRIBUTES_HPP_
|
|
|
|
|
|
// OSRM_ATTR_WARN_UNUSED - caller has to use function's return value
|
|
// https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
|
|
|
|
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
|
#define OSRM_ATTR_WARN_UNUSED __attribute__ ((warn_unused_result))
|
|
#else
|
|
#define OSRM_ATTR_WARN_UNUSED
|
|
#endif
|
|
|
|
|
|
#endif
|