WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
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#pragma once
6
7// This should only be used on APIs that can be compiled as C or C++. If the API
8// is C++ only, use [[nodiscard]] instead.
9#ifndef WPI_NODISCARD
10#ifdef __cplusplus
11#define WPI_NODISCARD [[nodiscard]]
12#elif defined(__GNUC__) || defined(__llvm__)
13#define WPI_NODISCARD __attribute__((warn_unused_result))
14#elif _MSC_VER
15#define WPI_NODISCARD _Check_return_
16#endif
17
18#endif