Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: src/IceBuildDefs.h

Issue 1519113003: fix doxygen for IceBuildDefs.h (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: changes suggested by stichnot Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceBuildDefs.h - Translator build defines ----*- C++ -*-===// 1 //===- subzero/src/IceBuildDefs.h - Translator build defines ----*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
11 /// \brief Defines constexpr functions to query various #define values. 11 /// \brief Define the Ice::BuildDefs namespace
12 ///
13 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
14 13
15 #ifndef SUBZERO_SRC_ICEBUILDDEFS_H 14 #ifndef SUBZERO_SRC_ICEBUILDDEFS_H
16 #define SUBZERO_SRC_ICEBUILDDEFS_H 15 #define SUBZERO_SRC_ICEBUILDDEFS_H
17 16
18 namespace Ice { 17 namespace Ice {
18 /// \brief Defines constexpr functions that express various Subzero build
19 /// system defined values.
20 ///
21 /// These resulting constexpr functions allow code to in effect be
22 /// conditionally compiled without having to do this using the older C++
23 /// preprocessor solution.
24
25 /** \verbatim
26
27 For example whenever the value of FEATURE_SUPPORTED is needed, instead
28 of (except in these constexpr functions):
29
30 #if FEATURE_SUPPORTED ...
31 ...
32 #endif
33
34 We can have:
Jim Stichnoth 2015/12/12 03:39:36 How about a blank line between prose and sample co
rkotlerimgtec 2015/12/12 04:24:38 Done.
35 namespace Ice {
36 namespace BuildDefs
Jim Stichnoth 2015/12/12 03:39:35 add "{" at the end of line
rkotlerimgtec 2015/12/12 04:24:38 Done.
37
38 // Use this form when FEATURE_SUPPORTED is guaranteed to be defined on the
39 // C++ compiler command line as 0 or 1.
40 constexpr bool hasFeature() { return FEATURE_SUPPORTED; }
41
42 or
43
44 // Use this form when FEATURE_SUPPORTED may not necessarily be defined on
45 // the C++ compiler command line.
46 constexpr bool hasFeature() {
47 #if FEATURE_SUPPORTED
48 return true;
49 #else // !FEATURE_SUPPORTED
50 return false;
51 #endif // !FEATURE_SUPPORTED
52 }
53
54 ...} // end of namespace BuildDefs
55 } // end of namespace Ice
56
57
58 And later in the code:
59
60 if (Ice::BuildDefs::hasFeature() {
61 ...
62 }
63
64 \endverbatim
Jim Stichnoth 2015/12/12 03:39:35 Blank line after this?
rkotlerimgtec 2015/12/12 04:24:39 Done.
65 Since hasFeature() returns a constexpr, an optimizing compiler will know to
66 keep or discard the above fragment. In addition, the code will always be
67 looked at by the compiler which eliminates the problem with defines in that
68 if you don't build that variant, you don't even know if the code would
69 compile unless you build with that variant.
70
71 **/
72
73
19 namespace BuildDefs { 74 namespace BuildDefs {
20 75
21 // The ALLOW_* etc. symbols must be #defined to zero or non-zero. 76 // The ALLOW_* etc. symbols must be #defined to zero or non-zero.
77 /// Return true if ALLOW_DISABLE_IR_GEN is defined as a non-zero value
22 constexpr bool disableIrGen() { return ALLOW_DISABLE_IR_GEN; } 78 constexpr bool disableIrGen() { return ALLOW_DISABLE_IR_GEN; }
79 /// Return true if ALLOW_DUMP is defined as a non-zero value
23 constexpr bool dump() { return ALLOW_DUMP; } 80 constexpr bool dump() { return ALLOW_DUMP; }
81 /// Return true if ALLOW_LLVM_CL is defined as a non-zero value
24 constexpr bool llvmCl() { return ALLOW_LLVM_CL; } 82 constexpr bool llvmCl() { return ALLOW_LLVM_CL; }
83 /// Return true if ALLOW_LLVM_IR is defined as a non-zero value
25 constexpr bool llvmIr() { return ALLOW_LLVM_IR; } 84 constexpr bool llvmIr() { return ALLOW_LLVM_IR; }
85 /// Return true if ALLOW_LLVM_IR_AS_INPUT is defined as a non-zero value
26 constexpr bool llvmIrAsInput() { return ALLOW_LLVM_IR_AS_INPUT; } 86 constexpr bool llvmIrAsInput() { return ALLOW_LLVM_IR_AS_INPUT; }
87 /// Return true if ALLOW_MINIMUM_BUILD is defined as a non-zero value
Jim Stichnoth 2015/12/12 03:39:35 ALLOW_MINIMAL_BUILD
rkotlerimgtec 2015/12/12 04:24:38 Done.
27 constexpr bool minimal() { return ALLOW_MINIMAL_BUILD; } 88 constexpr bool minimal() { return ALLOW_MINIMAL_BUILD; }
28 89
29 // NDEBUG can be undefined, or defined to something arbitrary. 90 /// Return true if NDEBUG is defined
30 constexpr bool asserts() { 91 constexpr bool asserts() {
31 #ifdef NDEBUG 92 #ifdef NDEBUG
32 return false; 93 return false;
33 #else // !NDEBUG 94 #else // !NDEBUG
34 return true; 95 return true;
35 #endif // !NDEBUG 96 #endif // !NDEBUG
36 } 97 }
37 98
38 // PNACL_BROWSER_TRANSLATOR can be undefined, or defined to something non-zero 99 /// Return true if PNACL_BROWSER_TRANSLATOR is defined
39 // to indicate a browser-based translator.
40 constexpr bool browser() { 100 constexpr bool browser() {
41 #if PNACL_BROWSER_TRANSLATOR 101 #if PNACL_BROWSER_TRANSLATOR
42 return true; 102 return true;
43 #else // !PNACL_BROWSER_TRANSLATOR 103 #else // !PNACL_BROWSER_TRANSLATOR
44 return false; 104 return false;
45 #endif // !PNACL_BROWSER_TRANSLATOR 105 #endif // !PNACL_BROWSER_TRANSLATOR
46 } 106 }
47 107
48 // ALLOW_EXTRA_VALIDATION can be undefined, or defined to something non-zero. 108 /// Return true if ALLOW_EXTRA_VALIDATION is defined
49 constexpr bool extraValidation() { 109 constexpr bool extraValidation() {
50 #if ALLOW_EXTRA_VALIDATION 110 #if ALLOW_EXTRA_VALIDATION
51 return true; 111 return true;
52 #else // !ALLOW_EXTRA_VALIDATION 112 #else // !ALLOW_EXTRA_VALIDATION
53 return false; 113 return false;
54 #endif // !ALLOW_EXTRA_VALIDATION 114 #endif // !ALLOW_EXTRA_VALIDATION
55 } 115 }
56 116
57 } // end of namespace BuildDefs 117 } // end of namespace BuildDefs
58 } // end of namespace Ice 118 } // end of namespace Ice
59 119
60 #endif // SUBZERO_SRC_ICEBUILDDEFS_H 120 #endif // SUBZERO_SRC_ICEBUILDDEFS_H
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698