tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

verref.h (1268B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 /* This header is used inline in a function to ensure that a version string
      6 * symbol is linked in and not optimized out. A volatile reference is added to
      7 * the variable identified by NSS_VERSION_VARIABLE.
      8 *
      9 * Use this as follows:
     10 *
     11 * #define NSS_VERSION_VARIABLE __nss_ssl_version
     12 * #include "verref.h"
     13 */
     14 
     15 /* Suppress unused variable warnings. */
     16 #ifdef _MSC_VER
     17 #pragma warning(push)
     18 #pragma warning(disable : 4101)
     19 #endif
     20 /* This works for both gcc and clang */
     21 #if defined(__GNUC__) && !defined(NSS_NO_GCC48)
     22 #pragma GCC diagnostic push
     23 #pragma GCC diagnostic ignored "-Wunused-variable"
     24 #endif
     25 
     26 #ifndef NSS_VERSION_VARIABLE
     27 #error NSS_VERSION_VARIABLE must be set before including "verref.h"
     28 #endif
     29 {
     30    extern const char NSS_VERSION_VARIABLE[];
     31 #if defined(__GNUC__) || defined(__clang__)
     32    __attribute__((unused))
     33 #endif
     34    volatile const char _nss_version_c = NSS_VERSION_VARIABLE[0];
     35 }
     36 #undef NSS_VERSION_VARIABLE
     37 
     38 #ifdef _MSC_VER
     39 #pragma warning(pop)
     40 #endif
     41 #if defined(__GNUC__) && !defined(NSS_NO_GCC48)
     42 #pragma GCC diagnostic pop
     43 #endif