Annotate exported declarations with DPM_PUBLIC_ABI_EXPORT
The export marker sat in the leading position of each declaration, where a name reads as part of the return type. It now sits on its own line above the declaration, where it reads as an annotation on it, and its name says what it marks: a declaration belonging to the public ABI.
This commit is contained in:
@@ -40,13 +40,15 @@ extern "C" {
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* @brief Marks the public API visible
|
||||
* @brief Marks a declaration as part of the public ABI
|
||||
*
|
||||
* The library is compiled with hidden default symbol visibility; the
|
||||
* functions carrying this are its entire exported surface.
|
||||
* declarations carrying this are its entire exported surface. It sits
|
||||
* on its own line above the declaration it applies to, so it reads as
|
||||
* an annotation rather than as part of the return type.
|
||||
*/
|
||||
#ifndef DPM_API
|
||||
#define DPM_API __attribute__((visibility("default")))
|
||||
#ifndef DPM_PUBLIC_ABI_EXPORT
|
||||
#define DPM_PUBLIC_ABI_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
@@ -148,7 +150,8 @@ typedef struct dpm_module_info {
|
||||
* unreadable/invalid explicit override (a missing default
|
||||
* config directory is not an error)
|
||||
*/
|
||||
DPM_API dpm_ctx* dpm_open(const dpm_open_overrides* overrides);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
dpm_ctx* dpm_open(const dpm_open_overrides* overrides);
|
||||
|
||||
/**
|
||||
* @brief Releases a libdpm-core context
|
||||
@@ -159,7 +162,8 @@ DPM_API dpm_ctx* dpm_open(const dpm_open_overrides* overrides);
|
||||
*
|
||||
* @param ctx The context to release; NULL is a no-op
|
||||
*/
|
||||
DPM_API void dpm_close(dpm_ctx* ctx);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
void dpm_close(dpm_ctx* ctx);
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Module acquisition */
|
||||
@@ -182,7 +186,8 @@ DPM_API void dpm_close(dpm_ctx* ctx);
|
||||
* @return A module handle owned by the context, or NULL on failure
|
||||
* with the precise reason retrievable via dpm_last_error()
|
||||
*/
|
||||
DPM_API dpm_module* dpm_require(dpm_ctx* ctx, const char* name);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
dpm_module* dpm_require(dpm_ctx* ctx, const char* name);
|
||||
|
||||
/**
|
||||
* @brief Reports what the library sees in a loaded module
|
||||
@@ -197,7 +202,8 @@ DPM_API dpm_module* dpm_require(dpm_ctx* ctx, const char* name);
|
||||
* remain valid until context close
|
||||
* @return 0 on success, nonzero if the module cannot be reported on
|
||||
*/
|
||||
DPM_API int dpm_module_info_of(dpm_ctx* ctx, dpm_module* mod,
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
int dpm_module_info_of(dpm_ctx* ctx, dpm_module* mod,
|
||||
dpm_module_info* out);
|
||||
|
||||
/**
|
||||
@@ -220,7 +226,8 @@ DPM_API int dpm_module_info_of(dpm_ctx* ctx, dpm_module* mod,
|
||||
* @param argv Argument vector
|
||||
* @return The module's return value verbatim; 0 on success
|
||||
*/
|
||||
DPM_API int dpm_execute(dpm_ctx* ctx, dpm_module* mod, const char* command,
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
int dpm_execute(dpm_ctx* ctx, dpm_module* mod, const char* command,
|
||||
int argc, char** argv);
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
@@ -237,7 +244,8 @@ DPM_API int dpm_execute(dpm_ctx* ctx, dpm_module* mod, const char* command,
|
||||
* @return A cursor over all valid modules, or NULL on an unreadable
|
||||
* module path
|
||||
*/
|
||||
DPM_API dpm_cursor* dpm_list_modules(dpm_ctx* ctx);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
dpm_cursor* dpm_list_modules(dpm_ctx* ctx);
|
||||
|
||||
/**
|
||||
* @brief Advances an enumeration cursor
|
||||
@@ -249,14 +257,16 @@ DPM_API dpm_cursor* dpm_list_modules(dpm_ctx* ctx);
|
||||
* @param out Receives the next module's information
|
||||
* @return 0 while entries remain; nonzero at end
|
||||
*/
|
||||
DPM_API int dpm_cursor_next(dpm_cursor* cur, dpm_module_info* out);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
int dpm_cursor_next(dpm_cursor* cur, dpm_module_info* out);
|
||||
|
||||
/**
|
||||
* @brief Releases an enumeration cursor
|
||||
*
|
||||
* @param cur The cursor to release; NULL is a no-op
|
||||
*/
|
||||
DPM_API void dpm_cursor_free(dpm_cursor* cur);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
void dpm_cursor_free(dpm_cursor* cur);
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Services (available to modules and external consumers alike) */
|
||||
@@ -268,7 +278,8 @@ DPM_API void dpm_cursor_free(dpm_cursor* cur);
|
||||
* @return The libdpm-core version as a static X.Y.Z string; callable
|
||||
* without a context
|
||||
*/
|
||||
DPM_API const char* dpm_core_version(void);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
const char* dpm_core_version(void);
|
||||
|
||||
/**
|
||||
* @brief Returns a configuration value from a module's namespace
|
||||
@@ -284,7 +295,8 @@ DPM_API const char* dpm_core_version(void);
|
||||
* @return The configured value, or NULL if unset; valid until
|
||||
* context close
|
||||
*/
|
||||
DPM_API const char* dpm_config_get(dpm_ctx* ctx, const char* module,
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
const char* dpm_config_get(dpm_ctx* ctx, const char* module,
|
||||
const char* section, const char* key);
|
||||
|
||||
/**
|
||||
@@ -297,7 +309,8 @@ DPM_API const char* dpm_config_get(dpm_ctx* ctx, const char* module,
|
||||
* @param level The severity (DPM_LOG_FATAL through DPM_LOG_DEBUG)
|
||||
* @param message The message to log; NULL is a no-op
|
||||
*/
|
||||
DPM_API void dpm_log(dpm_ctx* ctx, int level, const char* message);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
void dpm_log(dpm_ctx* ctx, int level, const char* message);
|
||||
|
||||
/**
|
||||
* @brief Returns the resolved module directory path
|
||||
@@ -305,7 +318,8 @@ DPM_API void dpm_log(dpm_ctx* ctx, int level, const char* message);
|
||||
* @param ctx The libdpm-core context
|
||||
* @return The module directory path this context resolved
|
||||
*/
|
||||
DPM_API const char* dpm_module_path(dpm_ctx* ctx);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
const char* dpm_module_path(dpm_ctx* ctx);
|
||||
|
||||
/**
|
||||
* @brief Returns the most recent failure recorded on the context
|
||||
@@ -314,7 +328,8 @@ DPM_API const char* dpm_module_path(dpm_ctx* ctx);
|
||||
* @return A human-readable description of the most recent failure, or
|
||||
* NULL if none; overwritten by the next failing call
|
||||
*/
|
||||
DPM_API const char* dpm_last_error(dpm_ctx* ctx);
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
const char* dpm_last_error(dpm_ctx* ctx);
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Module contract (implemented by modules, called by libdpm-core) */
|
||||
|
||||
Reference in New Issue
Block a user