Branch
Hash :
3e9a1375
Author :
Date :
2025-04-30T16:03:03
Fix unique object duplication warning Clang has a `unique-object-duplication` warning that warns about objects which are supposed to be unique (like static- or thread-local variables), but may be accidentally duplicated across shared libraries when they have hidden visibility. This CL addresses instances of that warning by: 1. Ensuring that on non-windows systems, objects that need to be exported are unconditionally given "default" visibility 2. Satisfy the compiler by marking everything as default visibility when building a static library, since visibility only matters for shared libraries 3. Mark functions with static or thread local variables as exported. Bug: chromium:368047728 Change-Id: Ic60265353bf2b0af2cd1fef884bfa85038e0db02 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6502093 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
//
// Copyright 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// export.h : Defines ANGLE_EXPORT, a macro for exporting functions from the DLL
#ifndef LIBGLESV2_EXPORT_H_
#define LIBGLESV2_EXPORT_H_
#if !defined(ANGLE_EXPORT)
# if defined(_WIN32)
# if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
defined(LIBFEATURE_SUPPORT_IMPLEMENTATION) || defined(LIBCL_IMPLEMENTATION)
# define ANGLE_EXPORT __declspec(dllexport)
# else
# define ANGLE_EXPORT __declspec(dllimport)
# endif
# elif defined(__GNUC__)
# define ANGLE_EXPORT __attribute__((visibility("default")))
# else
# define ANGLE_EXPORT
# endif
#endif // !defined(ANGLE_EXPORT)
#if !defined(ANGLE_NO_EXPORT)
# if defined(__GNUC__)
# define ANGLE_NO_EXPORT __attribute__((visibility("hidden")))
# else
# define ANGLE_NO_EXPORT
# endif
#endif // !defined(ANGLE_NO_EXPORT)
#endif // LIBGLESV2_EXPORT_H_