Skip to content

Compiler warning in src/opentime/timeRange.h when compiling in shared lib mode #2004

@jfpanisset

Description

@jfpanisset

On Linux, when building OTIO 0.18.1 with OTIO_SHARED_LIBS, gcc 14 in C++ 20 mode, you get the following warning for almost every C++ file:

src/opentime/timeRange.h:19:31: warning: 'visibility' attribute ignored [-Wattributes]
19 | OPENTIME_API constexpr double DEFAULT_EPSILON_s = 1.0 / (2 * 192000.0);

The definition of DEFAULT_EPSILON is:

OPENTIME_API constexpr double DEFAULT_EPSILON_s = 1.0 / (2 * 192000.0);

and when OPENTIME_EXPORT is defined, in src/opentime/export.h:

...
#elif defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__)
#    define OPENTIMELINEIO_EXPORT __attribute__((visibility("default")))
...
define OPENTIME_API OPENTIMELINEIO_EXPORT

I believe const objects automatically have internal linkage unless you make them extern, so the visibility attribute does not apply to DEFAULT_EPSILON, hence the warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions