Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:40:51

0001 //
0002 //  Copyright 2019 The Abseil Authors.
0003 //
0004 // Licensed under the Apache License, Version 2.0 (the "License");
0005 // you may not use this file except in compliance with the License.
0006 // You may obtain a copy of the License at
0007 //
0008 //      https://www.apache.org/licenses/LICENSE-2.0
0009 //
0010 // Unless required by applicable law or agreed to in writing, software
0011 // distributed under the License is distributed on an "AS IS" BASIS,
0012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013 // See the License for the specific language governing permissions and
0014 // limitations under the License.
0015 //
0016 // -----------------------------------------------------------------------------
0017 // File: declare.h
0018 // -----------------------------------------------------------------------------
0019 //
0020 // This file defines the ABSL_DECLARE_FLAG macro, allowing you to declare an
0021 // `absl::Flag` for use within a translation unit. You should place this
0022 // declaration within the header file associated with the .cc file that defines
0023 // and owns the `Flag`.
0024 
0025 #ifndef ABSL_FLAGS_DECLARE_H_
0026 #define ABSL_FLAGS_DECLARE_H_
0027 
0028 #include "absl/base/config.h"
0029 
0030 namespace absl {
0031 ABSL_NAMESPACE_BEGIN
0032 namespace flags_internal {
0033 
0034 // absl::Flag<T> represents a flag of type 'T' created by ABSL_FLAG.
0035 template <typename T>
0036 class Flag;
0037 
0038 }  // namespace flags_internal
0039 
0040 // Flag
0041 //
0042 // Forward declaration of the `absl::Flag` type for use in defining the macro.
0043 template <typename T>
0044 using Flag = flags_internal::Flag<T>;
0045 
0046 ABSL_NAMESPACE_END
0047 }  // namespace absl
0048 
0049 // ABSL_DECLARE_FLAG()
0050 //
0051 // This macro is a convenience for declaring use of an `absl::Flag` within a
0052 // translation unit. This macro should be used within a header file to
0053 // declare usage of the flag within any .cc file including that header file.
0054 //
0055 // The ABSL_DECLARE_FLAG(type, name) macro expands to:
0056 //
0057 //   extern absl::Flag<type> FLAGS_name;
0058 #define ABSL_DECLARE_FLAG(type, name) ABSL_DECLARE_FLAG_INTERNAL(type, name)
0059 
0060 // Internal implementation of ABSL_DECLARE_FLAG to allow macro expansion of its
0061 // arguments. Clients must use ABSL_DECLARE_FLAG instead.
0062 #define ABSL_DECLARE_FLAG_INTERNAL(type, name)               \
0063   extern absl::Flag<type> FLAGS_##name;                      \
0064   namespace absl /* block flags in namespaces */ {}          \
0065   /* second redeclaration is to allow applying attributes */ \
0066   extern absl::Flag<type> FLAGS_##name
0067 
0068 #endif  // ABSL_FLAGS_DECLARE_H_