MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
Loading...
Searching...
No Matches
MaxMatrixAttributes.h
Go to the documentation of this file.
1
// Copyright 2026 Andreas Burnickl
2
// SPDX-License-Identifier: GPL-3.0-or-later
3
9
10
#ifndef MAXMATRIX_SRC_MAXMATRIXATTRIBUTES_H_
11
#define MAXMATRIX_SRC_MAXMATRIXATTRIBUTES_H_
12
23
/*
24
* Chosen by what the compiler has rather than by __cplusplus, against FN-10:
25
* avr-gcc 7.3, GCC and clang have [[nodiscard]] in gnu++11 already, and
26
* warn_unused_result made the examples 10 to 30 bytes larger on the Uno, while
27
* [[nodiscard]] costs nothing. clang warns of it before C++17 only under
28
* -Wpedantic. Two #if, as a preprocessor without __has_cpp_attribute cannot
29
* read it in a condition.
30
*/
31
#ifdef __has_cpp_attribute
32
#if __has_cpp_attribute(nodiscard)
33
#define MAXMATRIX_NODISCARD [[nodiscard]]
34
#endif
35
#endif
36
#ifndef MAXMATRIX_NODISCARD
37
#define MAXMATRIX_NODISCARD __attribute__((warn_unused_result))
38
#endif
39
40
namespace
max_matrix {
41
52
template
<
typename
Value>
53
void
Discard
(Value
const
&
/* result */
) {}
54
55
}
// namespace max_matrix
56
57
#endif
// MAXMATRIX_SRC_MAXMATRIXATTRIBUTES_H_
max_matrix::Discard
void Discard(Value const &)
Drops a result marked with MAXMATRIX_NODISCARD on purpose, with the reason in a comment beside the ca...
Definition
MaxMatrixAttributes.h:53
src
MaxMatrixAttributes.h
Generated by
1.15.0