Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
compiler_specific.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_FML_COMPILER_SPECIFIC_H_
6#define FLUTTER_FML_COMPILER_SPECIFIC_H_
7
8#if !defined(__GNUC__) && !defined(__clang__) && !defined(_MSC_VER)
9#error Unsupported compiler.
10#endif
11
12// Annotate a variable indicating it's ok if the variable is not used.
13// (Typically used to silence a compiler warning when the assignment
14// is important for some other reason.)
15// Use like:
16// int x = ...;
17// FML_ALLOW_UNUSED_LOCAL(x);
18#define FML_ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
19
20// Annotate a typedef or function indicating it's ok if it's not used.
21// Use like:
22// typedef Foo Bar ALLOW_UNUSED_TYPE;
23#if defined(__GNUC__) || defined(__clang__)
24#define FML_ALLOW_UNUSED_TYPE __attribute__((unused))
25#else
26#define FML_ALLOW_UNUSED_TYPE
27#endif
28
29#endif // FLUTTER_FML_COMPILER_SPECIFIC_H_