From ce76abb4c49a85d491a99318637c6e9e37729f6e Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Fri, 2 Sep 2016 11:23:16 -0400 Subject: Tests: Add data symbols to GenerateExportHeader test Add static data members and global variables to the GenerateExportHeader shared library, testing that export decoration for these works in addition to decoration of classes and free functions. --- .../GenerateExportHeader/exportheader_test.cpp | 20 ++++++++++++++++ .../GenerateExportHeader/libshared/libshared.cpp | 28 ++++++++++++++++++++++ .../GenerateExportHeader/libshared/libshared.h | 26 ++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp index 3a4e7dd..fc6cceb 100644 --- a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp @@ -66,6 +66,14 @@ int main() #else // l.libshared_excluded(); LINK ERROR (NOT WIN32 AND NOT CYGWIN) #endif + + use_int(l.data_exported); + use_int(l.data_not_exported); +#if defined(_WIN32) || defined(__CYGWIN__) + use_int(l.data_excluded); +#else +// use_int(l.data_excluded); LINK ERROR (NOT WIN32 AND NOT CYGWIN) +#endif } { @@ -75,6 +83,10 @@ int main() l.libshared_deprecated(); // l.libshared_not_exported(); LINK ERROR // l.libshared_excluded(); LINK ERROR + + use_int(l.data_exported); + // use_int(l.data_not_exported); LINK ERROR + // use_int(l.data_excluded); LINK ERROR } { @@ -84,6 +96,10 @@ int main() l.libshared_deprecated(); // l.libshared_not_exported(); LINK ERROR // l.libshared_excluded(); LINK ERROR + + use_int(l.data_exported); + // use_int(l.data_not_exported); LINK ERROR + // use_int(l.data_excluded); LINK ERROR } libshared_exported(); @@ -91,6 +107,10 @@ int main() // libshared_not_exported(); LINK ERROR // libshared_excluded(); LINK ERROR + use_int(data_exported); + // use_int(data_not_exported); LINK ERROR + // use_int(data_excluded); LINK ERROR + { Libstatic l; l.libstatic(); diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp index ad6d356..7e46ab5 100644 --- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp @@ -26,6 +26,12 @@ int Libshared::libshared_excluded() const return 0; } +int const Libshared::data_exported = 1; + +int const Libshared::data_not_exported = 1; + +int const Libshared::data_excluded = 1; + int LibsharedNotExported::libshared() const { return 0; @@ -51,6 +57,12 @@ int LibsharedNotExported::libshared_excluded() const return 0; } +int const LibsharedNotExported::data_exported = 1; + +int const LibsharedNotExported::data_not_exported = 1; + +int const LibsharedNotExported::data_excluded = 1; + int LibsharedExcluded::libshared() const { return 0; @@ -76,6 +88,12 @@ int LibsharedExcluded::libshared_excluded() const return 0; } +int const LibsharedExcluded::data_exported = 1; + +int const LibsharedExcluded::data_not_exported = 1; + +int const LibsharedExcluded::data_excluded = 1; + int libshared() { return 0; @@ -100,3 +118,13 @@ int libshared_excluded() { return 0; } + +int const data_exported = 1; + +int const data_not_exported = 1; + +int const data_excluded = 1; + +void use_int(int) +{ +} diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h index bd9f2e3..62879c2 100644 --- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h @@ -16,6 +16,12 @@ public: int libshared_not_exported() const; int LIBSHARED_NO_EXPORT libshared_excluded() const; + + static int const LIBSHARED_EXPORT data_exported; + + static int const data_not_exported; + + static int const LIBSHARED_NO_EXPORT data_excluded; }; class LibsharedNotExported @@ -30,6 +36,12 @@ public: int libshared_not_exported() const; int LIBSHARED_NO_EXPORT libshared_excluded() const; + + static int const LIBSHARED_EXPORT data_exported; + + static int const data_not_exported; + + static int const LIBSHARED_NO_EXPORT data_excluded; }; class LIBSHARED_NO_EXPORT LibsharedExcluded @@ -44,6 +56,12 @@ public: int libshared_not_exported() const; int LIBSHARED_NO_EXPORT libshared_excluded() const; + + static int const LIBSHARED_EXPORT data_exported; + + static int const data_not_exported; + + static int const LIBSHARED_NO_EXPORT data_excluded; }; LIBSHARED_EXPORT int libshared_exported(); @@ -54,4 +72,12 @@ int libshared_not_exported(); int LIBSHARED_NO_EXPORT libshared_excluded(); +extern int const LIBSHARED_EXPORT data_exported; + +extern int const data_not_exported; + +extern int const LIBSHARED_NO_EXPORT data_excluded; + +LIBSHARED_EXPORT void use_int(int); + #endif -- cgit v0.12