Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Id32f6ac1b75fdea7c408a40438577608df48b782
# define ARGPAR_HIDDEN __attribute__((visibility("hidden")))
#endif
# define ARGPAR_HIDDEN __attribute__((visibility("hidden")))
#endif
+/* Internal: `noexcept` specifier if C++ ≥ 11 */
+#if defined(__cplusplus) && (__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900))
+# define ARGPAR_NOEXCEPT noexcept
+#else
+# define ARGPAR_NOEXCEPT
+#endif
+
struct argpar_opt_descr;
/*!
struct argpar_opt_descr;
/*!
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-enum argpar_item_type argpar_item_type(const struct argpar_item *item);
+enum argpar_item_type argpar_item_type(
+ const struct argpar_item *item) ARGPAR_NOEXCEPT;
ARGPAR_HIDDEN
/// @endcond
const struct argpar_opt_descr *argpar_item_opt_descr(
ARGPAR_HIDDEN
/// @endcond
const struct argpar_opt_descr *argpar_item_opt_descr(
- const struct argpar_item *item);
+ const struct argpar_item *item) ARGPAR_NOEXCEPT;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-const char *argpar_item_opt_arg(const struct argpar_item *item);
+const char *argpar_item_opt_arg(const struct argpar_item *item) ARGPAR_NOEXCEPT;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-const char *argpar_item_non_opt_arg(const struct argpar_item *item);
+const char *argpar_item_non_opt_arg(
+ const struct argpar_item *item) ARGPAR_NOEXCEPT;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-unsigned int argpar_item_non_opt_orig_index(const struct argpar_item *item);
+unsigned int argpar_item_non_opt_orig_index(
+ const struct argpar_item *item) ARGPAR_NOEXCEPT;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-unsigned int argpar_item_non_opt_non_opt_index(const struct argpar_item *item);
+unsigned int argpar_item_non_opt_non_opt_index(
+ const struct argpar_item *item) ARGPAR_NOEXCEPT;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-void argpar_item_destroy(const struct argpar_item *item);
+void argpar_item_destroy(const struct argpar_item *item) ARGPAR_NOEXCEPT;
/*!
@def ARGPAR_ITEM_DESTROY_AND_RESET(_item)
/*!
@def ARGPAR_ITEM_DESTROY_AND_RESET(_item)
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-enum argpar_error_type argpar_error_type(const struct argpar_error *error);
+enum argpar_error_type argpar_error_type(
+ const struct argpar_error *error) ARGPAR_NOEXCEPT;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-unsigned int argpar_error_orig_index(const struct argpar_error *error);
+unsigned int argpar_error_orig_index(
+ const struct argpar_error *error) ARGPAR_NOEXCEPT;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-const char *argpar_error_unknown_opt_name(const struct argpar_error *error);
+const char *argpar_error_unknown_opt_name(
+ const struct argpar_error *error) ARGPAR_NOEXCEPT;
ARGPAR_HIDDEN
/// @endcond
const struct argpar_opt_descr *argpar_error_opt_descr(
ARGPAR_HIDDEN
/// @endcond
const struct argpar_opt_descr *argpar_error_opt_descr(
- const struct argpar_error *error, bool *is_short);
+ const struct argpar_error *error,
+ bool *is_short) ARGPAR_NOEXCEPT;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-void argpar_error_destroy(const struct argpar_error *error);
+void argpar_error_destroy(const struct argpar_error *error) ARGPAR_NOEXCEPT;
/// @endcond
struct argpar_iter *argpar_iter_create(unsigned int argc,
const char * const *argv,
/// @endcond
struct argpar_iter *argpar_iter_create(unsigned int argc,
const char * const *argv,
- const struct argpar_opt_descr *descrs);
+ const struct argpar_opt_descr *descrs) ARGPAR_NOEXCEPT;
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-void argpar_iter_destroy(struct argpar_iter *iter);
+void argpar_iter_destroy(struct argpar_iter *iter) ARGPAR_NOEXCEPT;
/// @endcond
enum argpar_iter_next_status argpar_iter_next(
struct argpar_iter *iter, const struct argpar_item **item,
/// @endcond
enum argpar_iter_next_status argpar_iter_next(
struct argpar_iter *iter, const struct argpar_item **item,
- const struct argpar_error **error);
+ const struct argpar_error **error) ARGPAR_NOEXCEPT;
/*
* Returns the number of ingested elements from `argv`, as passed to
/*
* Returns the number of ingested elements from `argv`, as passed to
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
/// @cond hidden_macro
ARGPAR_HIDDEN
/// @endcond
-unsigned int argpar_iter_ingested_orig_args(const struct argpar_iter *iter);
+unsigned int argpar_iter_ingested_orig_args(
+ const struct argpar_iter *iter) ARGPAR_NOEXCEPT;