/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <folly/init/Init.h> #include <cstdlib> #include <glog/logging.h> #include <folly/Singleton.h> #include <folly/init/Phase.h> #include <folly/logging/Init.h> #include <folly/portability/Config.h> #include <folly/synchronization/HazptrThreadPoolExecutor.h> #if !defined(_WIN32) #include <folly/experimental/symbolizer/SignalHandler.h> // @manual #endif #include <folly/portability/GFlags.h> FOLLY_GFLAGS_DEFINE_string(…); namespace folly { const unsigned long kAllFatalSignals = …; #else 0; #endif InitOptions::InitOptions() noexcept : … { … } namespace { #if FOLLY_USE_SYMBOLIZER // Newer versions of glog require the function passed to InstallFailureFunction // to be noreturn. But glog spells that in multiple possible ways, depending on // platform. But glog's choice of spelling does not match how the // noreturn-ability of std::abort is spelled. Some compilers consider this a // type mismatch on the function-ptr type. To fix the type mismatch, we wrap // std::abort and mimic the condition and the spellings from glog here. #if defined(__GNUC__) __attribute__((noreturn)) #else [[noreturn]] #endif static void wrapped_abort() { abort(); } #endif void initImpl(int* argc, char*** argv, InitOptions options) { … } } // namespace Init::Init(int* argc, char*** argv, bool removeFlags) { … } Init::Init(int* argc, char*** argv, InitOptions options) { … } Init::~Init() { … } void init(int* argc, char*** argv, bool removeFlags) { … } void init(int* argc, char*** argv, InitOptions options) { … } } // namespace folly