Blame src/base/googleinit.h

Packit Service 9def5d
// Copyright (c) 2008, Google Inc.
Packit Service 9def5d
// All rights reserved.
Packit Service 9def5d
// 
Packit Service 9def5d
// Redistribution and use in source and binary forms, with or without
Packit Service 9def5d
// modification, are permitted provided that the following conditions are
Packit Service 9def5d
// met:
Packit Service 9def5d
// 
Packit Service 9def5d
//     * Redistributions of source code must retain the above copyright
Packit Service 9def5d
// notice, this list of conditions and the following disclaimer.
Packit Service 9def5d
//     * Redistributions in binary form must reproduce the above
Packit Service 9def5d
// copyright notice, this list of conditions and the following disclaimer
Packit Service 9def5d
// in the documentation and/or other materials provided with the
Packit Service 9def5d
// distribution.
Packit Service 9def5d
//     * Neither the name of Google Inc. nor the names of its
Packit Service 9def5d
// contributors may be used to endorse or promote products derived from
Packit Service 9def5d
// this software without specific prior written permission.
Packit Service 9def5d
// 
Packit Service 9def5d
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit Service 9def5d
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit Service 9def5d
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit Service 9def5d
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit Service 9def5d
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit Service 9def5d
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit Service 9def5d
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit Service 9def5d
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit Service 9def5d
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit Service 9def5d
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit Service 9def5d
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 9def5d
Packit Service 9def5d
// ---
Packit Service 9def5d
// Author: Jacob Hoffman-Andrews
Packit Service 9def5d
Packit Service 9def5d
#ifndef _GOOGLEINIT_H
Packit Service 9def5d
#define _GOOGLEINIT_H
Packit Service 9def5d
Packit Service 9def5d
class GoogleInitializer {
Packit Service 9def5d
 public:
Packit Service 9def5d
  typedef void (*void_function)(void);
Packit Service 9def5d
  GoogleInitializer(const char*, void_function f) {
Packit Service 9def5d
    f();
Packit Service 9def5d
  }
Packit Service 9def5d
};
Packit Service 9def5d
Packit Service 9def5d
#define REGISTER_MODULE_INITIALIZER(name, body)                 \
Packit Service 9def5d
  namespace {                                                   \
Packit Service 9def5d
    static void google_init_module_##name () { body; }          \
Packit Service 9def5d
    GoogleInitializer google_initializer_module_##name(#name,   \
Packit Service 9def5d
            google_init_module_##name);                         \
Packit Service 9def5d
  }
Packit Service 9def5d
Packit Service 9def5d
#endif /* _GOOGLEINIT_H */