WPILibC++ 2023.4.3-108-ge5452e3
nodiscard.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#ifndef WPIUTIL_WPI_NODISCARD_H_
6#define WPIUTIL_WPI_NODISCARD_H_
7
8// This should only be used on APIs that can be compiled as C or C++. If the API
9// is C++ only, use [[nodiscard]] instead.
10#ifndef WPI_NODISCARD
11#ifdef __cplusplus
12#define WPI_NODISCARD [[nodiscard]]
13#elif defined(__GNUC__) || defined(__llvm__)
14#define WPI_NODISCARD __attribute__((warn_unused_result))
15#elif _MSC_VER
16#define WPI_NODISCARD _Check_return_
17#endif
18
19#endif
20
21#endif // WPIUTIL_WPI_NODISCARD_H_