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.
This commit is contained in:
Matthew Woehlke 2016-09-02 11:23:16 -04:00 committed by Brad King
parent 8f95b93b41
commit ce76abb4c4
3 changed files with 74 additions and 0 deletions

View File

@ -65,6 +65,14 @@ int main()
l.libshared_excluded(); l.libshared_excluded();
#else #else
// l.libshared_excluded(); LINK ERROR (NOT WIN32 AND NOT CYGWIN) // 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 #endif
} }
@ -75,6 +83,10 @@ int main()
l.libshared_deprecated(); l.libshared_deprecated();
// l.libshared_not_exported(); LINK ERROR // l.libshared_not_exported(); LINK ERROR
// l.libshared_excluded(); 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_deprecated();
// l.libshared_not_exported(); LINK ERROR // l.libshared_not_exported(); LINK ERROR
// l.libshared_excluded(); 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(); libshared_exported();
@ -91,6 +107,10 @@ int main()
// libshared_not_exported(); LINK ERROR // libshared_not_exported(); LINK ERROR
// libshared_excluded(); 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; Libstatic l;
l.libstatic(); l.libstatic();

View File

@ -26,6 +26,12 @@ int Libshared::libshared_excluded() const
return 0; 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 int LibsharedNotExported::libshared() const
{ {
return 0; return 0;
@ -51,6 +57,12 @@ int LibsharedNotExported::libshared_excluded() const
return 0; 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 int LibsharedExcluded::libshared() const
{ {
return 0; return 0;
@ -76,6 +88,12 @@ int LibsharedExcluded::libshared_excluded() const
return 0; return 0;
} }
int const LibsharedExcluded::data_exported = 1;
int const LibsharedExcluded::data_not_exported = 1;
int const LibsharedExcluded::data_excluded = 1;
int libshared() int libshared()
{ {
return 0; return 0;
@ -100,3 +118,13 @@ int libshared_excluded()
{ {
return 0; return 0;
} }
int const data_exported = 1;
int const data_not_exported = 1;
int const data_excluded = 1;
void use_int(int)
{
}

View File

@ -16,6 +16,12 @@ public:
int libshared_not_exported() const; int libshared_not_exported() const;
int LIBSHARED_NO_EXPORT libshared_excluded() 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 class LibsharedNotExported
@ -30,6 +36,12 @@ public:
int libshared_not_exported() const; int libshared_not_exported() const;
int LIBSHARED_NO_EXPORT libshared_excluded() 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 class LIBSHARED_NO_EXPORT LibsharedExcluded
@ -44,6 +56,12 @@ public:
int libshared_not_exported() const; int libshared_not_exported() const;
int LIBSHARED_NO_EXPORT libshared_excluded() 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(); LIBSHARED_EXPORT int libshared_exported();
@ -54,4 +72,12 @@ int libshared_not_exported();
int LIBSHARED_NO_EXPORT libshared_excluded(); 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 #endif