Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions libcpluff/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ extern "C" {
*
* @param arg the argument
*/
#ifdef __GNUC__
#define CHECK_NOT_NULL(arg) do { \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wnonnull-compare\"") \
if ((arg) == NULL) cpi_fatal_null_arg(#arg, __func__); \
_Pragma("GCC diagnostic pop") \
} while (0)
#else
#define CHECK_NOT_NULL(arg) do { if ((arg) == NULL) cpi_fatal_null_arg(#arg, __func__); } while (0)
#endif


/* ------------------------------------------------------------------------
Expand Down
28 changes: 14 additions & 14 deletions libcpluffxx/cpluffxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class framework {
*
* @return the release version of the C-Pluff implementation
*/
static const char* version() throw ();
static const char* version() noexcept;

/**
* Returns the canonical host type associated with the linked in
Expand All @@ -79,7 +79,7 @@ class framework {
*
* @return the canonical host type
*/
static const char* host_type() throw ();
static const char* host_type() noexcept;

/**
* Sets a global fatal error handler. The error handler
Expand All @@ -91,14 +91,14 @@ class framework {
*
* @param feh the fatal error handler to be installed
*/
static void fatal_error_handler(::cpluff::fatal_error_handler &feh) throw ();
static void fatal_error_handler(::cpluff::fatal_error_handler &feh) noexcept;

/**
* Resets the default fatal error handler which prints the error message to
* standard error and aborts the program. This function is not thread-safe
* with regards to other threads simultaneously invoking API.
*/
static void reset_fatal_error_handler() throw ();
static void reset_fatal_error_handler() noexcept;

/**
* Initializes the C-Pluff framework. The framework is automatically
Expand All @@ -113,7 +113,7 @@ class framework {
*
* @throw api_error if there are not enough system resources
*/
static shared_ptr<framework> init() throw (api_error);
static shared_ptr<framework> init();

/**
* Creates and returns a new plug-in container. The returned plug-in
Expand All @@ -123,7 +123,7 @@ class framework {
* @return reference to a new created plug-in container
* @throw api_error if there are not enough system resources
*/
virtual shared_ptr<plugin_container> new_plugin_container() throw (api_error) = 0;
virtual shared_ptr<plugin_container> new_plugin_container() = 0;

protected:

Expand Down Expand Up @@ -160,31 +160,31 @@ class plugin_context {
* @throw cpluff::api_error if insufficient memory
* @sa cpluff::unregister_logger
*/
virtual void register_logger(logger* logger, logger::severity minseverity) throw (api_error) = 0;
virtual void register_logger(logger* logger, logger::severity minseverity) = 0;

/**
* Removes a logger registration.
*
* @param logger the logger object to be unregistered
* @sa cpluff::register_logger
*/
virtual void unregister_logger(logger* logger) throw () = 0;
virtual void unregister_logger(logger* logger) noexcept = 0;

/**
* Emits a new log message.
*
* @param severity the severity of the event
* @param msg the log message (possibly localized)
*/
virtual void log(logger::severity severity, const char* msg) throw () = 0;
virtual void log(logger::severity severity, const char* msg) noexcept = 0;

/**
* Returns whether a message of the specified severity would get logged.
*
* @param severity the target logging severity
* @return whether a message of the specified severity would get logged
*/
virtual bool is_logged(logger::severity severity) throw () = 0;
virtual bool is_logged(logger::severity severity) noexcept = 0;

protected:

Expand Down Expand Up @@ -212,7 +212,7 @@ class plugin_container : public virtual plugin_context {
* @sa unregister_plugin_collection
* @sa unregister_plugin_collections
*/
virtual void register_plugin_collection(const char* dir) throw (api_error) = 0;
virtual void register_plugin_collection(const char* dir) = 0;

/**
* Unregisters a plug-in collection previously registered with this
Expand All @@ -222,15 +222,15 @@ class plugin_container : public virtual plugin_context {
* @param dir the previously registered directory
* @sa register_plugin_collection
*/
virtual void unregister_plugin_collection(const char* dir) throw () = 0;
virtual void unregister_plugin_collection(const char* dir) noexcept = 0;

/**
* Unregisters all plug-in collections registered with this plug-in
* container. Plug-ins already loaded from collections are not affected.
*
* @sa register_plugin_collection
*/
virtual void unregister_plugin_collections() throw () = 0;
virtual void unregister_plugin_collections() noexcept = 0;

/**
* Loads a plug-in descriptor from the specified plug-in installation
Expand All @@ -244,7 +244,7 @@ class plugin_container : public virtual plugin_context {
* @return reference to the plug-in information structure
* @throw cp_api_error if loading fails or the plug-in descriptor is malformed
*/
virtual shared_ptr<plugin_info> load_plugin_descriptor(const char* path) throw (api_error) = 0;
virtual shared_ptr<plugin_info> load_plugin_descriptor(const char* path) = 0;

protected:

Expand Down
2 changes: 1 addition & 1 deletion libcpluffxx/cpluffxx/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class less_str {
* @param s2 the second string to compare
* @return whether the first string comes before the second string
*/
inline bool operator()(const char* const& s1, const char* const& s2) {
inline bool operator()(const char* const& s1, const char* const& s2) const {
return strcmp(s1, s2) < 0;
}
};
Expand Down
12 changes: 6 additions & 6 deletions libcpluffxx/framework.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ static void invoke_fatal_error_handler(const char *msg) {
current_fatal_error_handler->fatal_error(msg);
}

const char* framework::version() throw () {
const char* framework::version() noexcept {
return cp_get_version();
}

const char* framework::host_type() throw () {
const char* framework::host_type() noexcept {
return cp_get_host_type();
}

void framework::fatal_error_handler(::cpluff::fatal_error_handler &feh) throw () {
void framework::fatal_error_handler(::cpluff::fatal_error_handler &feh) noexcept {
current_fatal_error_handler = &feh;
cp_set_fatal_error_handler(invoke_fatal_error_handler);
}

void framework::reset_fatal_error_handler() throw () {
void framework::reset_fatal_error_handler() noexcept {
current_fatal_error_handler = NULL;
cp_set_fatal_error_handler(NULL);
}

shared_ptr<framework> framework::init() throw (api_error) {
shared_ptr<framework> framework::init() {
shared_ptr<framework_impl> sp(new framework_impl);
sp.get()->this_shared(sp);
return sp;
}

CP_HIDDEN shared_ptr<plugin_container> framework_impl::new_plugin_container() throw (api_error) {
CP_HIDDEN shared_ptr<plugin_container> framework_impl::new_plugin_container() {
return shared_ptr<plugin_container>(new plugin_container_impl(shared_ptr<framework>(this_weak)));
}

Expand Down
32 changes: 16 additions & 16 deletions libcpluffxx/internalxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class framework_impl : public virtual framework {
this_weak = ts;
}

CP_HIDDEN shared_ptr<plugin_container> new_plugin_container() throw (api_error);
CP_HIDDEN shared_ptr<plugin_container> new_plugin_container();

private:
weak_ptr<framework> this_weak;
Expand All @@ -84,11 +84,11 @@ class plugin_import_impl : public virtual plugin_import {
*/
CP_HIDDEN plugin_import_impl(cp_plugin_import_t* pimport);

CP_HIDDEN const char* plugin_identifier() const throw ();
CP_HIDDEN const char* plugin_identifier() const noexcept;

CP_HIDDEN const char* version() const throw ();
CP_HIDDEN const char* version() const noexcept;

CP_HIDDEN bool is_optional() const throw ();
CP_HIDDEN bool is_optional() const noexcept;

private:

Expand All @@ -107,13 +107,13 @@ class plugin_context_impl : public virtual plugin_context {
*/
CP_HIDDEN plugin_context_impl(cp_context_t *context);

CP_HIDDEN void register_logger(logger* logger, logger::severity minseverity) throw (api_error);
CP_HIDDEN void register_logger(logger* logger, logger::severity minseverity);

CP_HIDDEN void unregister_logger(logger* logger) throw ();
CP_HIDDEN void unregister_logger(logger* logger) noexcept;

CP_HIDDEN void log(logger::severity severity, const char* msg) throw ();
CP_HIDDEN void log(logger::severity severity, const char* msg) noexcept;

CP_HIDDEN bool is_logged(logger::severity severity) throw ();
CP_HIDDEN bool is_logged(logger::severity severity) noexcept;

/**
* Emits a new formatted log message if the associated severity is being
Expand All @@ -122,7 +122,7 @@ class plugin_context_impl : public virtual plugin_context {
* @param severity the severity of the event
* @param msg the log message (possibly localized)
*/
CP_HIDDEN void logf(logger::severity severity, const char* msg, ...) throw ();
CP_HIDDEN void logf(logger::severity severity, const char* msg, ...) noexcept;

protected:

Expand All @@ -142,7 +142,7 @@ class plugin_context_impl : public virtual plugin_context {
* plug-in context are released and all pointers and references
* obtained via it become invalid.
*/
CP_HIDDEN ~plugin_context_impl() throw ();
CP_HIDDEN ~plugin_context_impl() noexcept;

private:

Expand All @@ -165,12 +165,12 @@ class plugin_context_impl : public virtual plugin_context {
* @param apid the identifier of the activating plug-in or NULL for the main program
* @param user_data pointer to the associated plug-in context object
*/
CP_HIDDEN static void deliver_log_message(cp_log_severity_t severity, const char* msg, const char* apid, void* user_data) throw ();
CP_HIDDEN static void deliver_log_message(cp_log_severity_t severity, const char* msg, const char* apid, void* user_data) noexcept;

/**
* Updates the aggregate minimum severity for installed loggers.
*/
CP_HIDDEN void update_min_logger_severity() throw ();
CP_HIDDEN void update_min_logger_severity() noexcept;
};

class plugin_container_impl : public plugin_container, public plugin_context_impl {
Expand All @@ -181,13 +181,13 @@ class plugin_container_impl : public plugin_container, public plugin_context_imp
*/
CP_HIDDEN plugin_container_impl(shared_ptr<framework> fw);

CP_HIDDEN void register_plugin_collection(const char* dir) throw (api_error);
CP_HIDDEN void register_plugin_collection(const char* dir);

CP_HIDDEN void unregister_plugin_collection(const char* dir) throw ();
CP_HIDDEN void unregister_plugin_collection(const char* dir) noexcept;

CP_HIDDEN void unregister_plugin_collections() throw ();
CP_HIDDEN void unregister_plugin_collections() noexcept;

CP_HIDDEN shared_ptr<plugin_info> load_plugin_descriptor(const char* path) throw (api_error);
CP_HIDDEN shared_ptr<plugin_info> load_plugin_descriptor(const char* path);

private:

Expand Down
8 changes: 4 additions & 4 deletions libcpluffxx/plugin_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ CP_HIDDEN plugin_container_impl::plugin_container_impl(shared_ptr<framework> fw)
this->context = context;
}

CP_HIDDEN void plugin_container_impl::register_plugin_collection(const char* dir) throw (api_error) {
CP_HIDDEN void plugin_container_impl::register_plugin_collection(const char* dir) {
check_cp_status(cp_register_pcollection(context, dir));
}

CP_HIDDEN void plugin_container_impl::unregister_plugin_collection(const char* dir) throw () {
CP_HIDDEN void plugin_container_impl::unregister_plugin_collection(const char* dir) noexcept {
cp_unregister_pcollection(context, dir);
}

CP_HIDDEN void plugin_container_impl::unregister_plugin_collections() throw () {
CP_HIDDEN void plugin_container_impl::unregister_plugin_collections() noexcept {
cp_unregister_pcollections(context);
}

CP_HIDDEN shared_ptr<plugin_info> plugin_container_impl::load_plugin_descriptor(const char* path) throw (api_error) {
CP_HIDDEN shared_ptr<plugin_info> plugin_container_impl::load_plugin_descriptor(const char* path) {
cp_status_t status;
cp_plugin_info_t *pinfo = cp_load_plugin_descriptor(context, path, &status);
check_cp_status(status);
Expand Down
16 changes: 8 additions & 8 deletions libcpluffxx/plugin_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,31 @@ CP_HIDDEN plugin_context_impl::plugin_context_impl() {
plugin_context_impl(NULL);
}

CP_HIDDEN plugin_context_impl::~plugin_context_impl() throw () {
CP_HIDDEN plugin_context_impl::~plugin_context_impl() noexcept {
cp_destroy_context(context);
}

CP_HIDDEN void plugin_context_impl::register_logger(logger* logger, logger::severity minseverity) throw (api_error) {
CP_HIDDEN void plugin_context_impl::register_logger(logger* logger, logger::severity minseverity) {
// TODO synchronization
loggers[logger] = minseverity;
update_min_logger_severity();
}

CP_HIDDEN void plugin_context_impl::unregister_logger(logger* logger) throw () {
CP_HIDDEN void plugin_context_impl::unregister_logger(logger* logger) noexcept {
// TODO synchronization
loggers.erase(logger);
update_min_logger_severity();
}

CP_HIDDEN void plugin_context_impl::log(logger::severity severity, const char* msg) throw () {
CP_HIDDEN void plugin_context_impl::log(logger::severity severity, const char* msg) noexcept {
cp_log(context, (cp_log_severity_t) severity, msg);
}

CP_HIDDEN bool plugin_context_impl::is_logged(logger::severity severity) throw () {
CP_HIDDEN bool plugin_context_impl::is_logged(logger::severity severity) noexcept {
return cp_is_logged(context, (cp_log_severity_t) severity);
}

CP_HIDDEN void plugin_context_impl::logf(logger::severity severity, const char* msg, ...) throw () {
CP_HIDDEN void plugin_context_impl::logf(logger::severity severity, const char* msg, ...) noexcept {
assert(msg != NULL);
assert(severity >= logger::DEBUG && severity <= logger::ERROR);

Expand All @@ -86,7 +86,7 @@ CP_HIDDEN void plugin_context_impl::logf(logger::severity severity, const char*
}
}

CP_HIDDEN void plugin_context_impl::deliver_log_message(cp_log_severity_t sev, const char* msg, const char* apid, void* user_data) throw () {
CP_HIDDEN void plugin_context_impl::deliver_log_message(cp_log_severity_t sev, const char* msg, const char* apid, void* user_data) noexcept {
plugin_context_impl* context = static_cast<plugin_context_impl*>(user_data);
std::map<logger*, logger::severity>::iterator iter;
// TODO synchronization
Expand All @@ -99,7 +99,7 @@ CP_HIDDEN void plugin_context_impl::deliver_log_message(cp_log_severity_t sev, c
}
}

CP_HIDDEN void plugin_context_impl::update_min_logger_severity() throw () {
CP_HIDDEN void plugin_context_impl::update_min_logger_severity() noexcept {
min_logger_severity = static_cast<logger::severity>(logger::ERROR + 1);
std::map<logger*, logger::severity>::iterator iter;
// TODO synchronization
Expand Down
4 changes: 2 additions & 2 deletions libcpluffxx/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace cpluff {
* @param status a status code from C API
* @return corresponding error message as C string
*/
static const char* status_to_cs_string(cp_status_t status) throw() {
static const char* status_to_cs_string(cp_status_t status) noexcept {
switch (status) {
case CP_ERR_RESOURCE:
return _("Insufficient system resources for the operation.");
Expand All @@ -60,7 +60,7 @@ static const char* status_to_cs_string(cp_status_t status) throw() {
}
}

CP_HIDDEN void check_cp_status(cp_status_t status) throw (api_error) {
CP_HIDDEN void check_cp_status(cp_status_t status) {
if (status != CP_OK) {
throw api_error(
(api_error::code) status,
Expand Down
2 changes: 1 addition & 1 deletion libcpluffxx/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace cpluff {
* @param status the status code from C API
* @throw cp_api_error if the status code indicates a failure
*/
CP_HIDDEN void check_cp_status(cp_status_t status) throw (api_error);
CP_HIDDEN void check_cp_status(cp_status_t status);

}

Expand Down
1 change: 1 addition & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
tmp
testsuite
testsuite_cxx