]> sigrok.org Git - libsigrok.git/blobdiff - src/libsigrok-internal.h
strutil: introduce sr_atoul_base() conversion helper (non-decimal)
[libsigrok.git] / src / libsigrok-internal.h
index 98d1631e2f4a4a5d3b209f3e85446e464799ccc6..44be53c6515355bc1a92cd608208643acdf06081 100644 (file)
@@ -967,6 +967,15 @@ static inline void write_dblle_inc(uint8_t **p, double x)
 #define SR_DRIVER_LIST_SECTION "__sr_driver_list"
 #endif
 
+#if !defined SR_DRIVER_LIST_NOREORDER && defined __has_attribute
+#if __has_attribute(no_reorder)
+#define SR_DRIVER_LIST_NOREORDER __attribute__((no_reorder))
+#endif
+#endif
+#if !defined SR_DRIVER_LIST_NOREORDER
+#define SR_DRIVER_LIST_NOREORDER /* EMPTY */
+#endif
+
 /**
  * Register a list of hardware drivers.
  *
@@ -996,6 +1005,7 @@ static inline void write_dblle_inc(uint8_t **p, double x)
  */
 #define SR_REGISTER_DEV_DRIVER_LIST(name, ...) \
        static const struct sr_dev_driver *name[] \
+               SR_DRIVER_LIST_NOREORDER \
                __attribute__((section (SR_DRIVER_LIST_SECTION), used, \
                        aligned(sizeof(struct sr_dev_driver *)))) \
                = { \
@@ -1799,6 +1809,7 @@ SR_PRIV void *sr_resource_load(struct sr_context *ctx, int type,
 
 SR_PRIV int sr_atol(const char *str, long *ret);
 SR_PRIV int sr_atol_base(const char *str, long *ret, char **end, int base);
+SR_PRIV int sr_atoul_base(const char *str, unsigned long *ret, char **end, int base);
 SR_PRIV int sr_atoi(const char *str, int *ret);
 SR_PRIV int sr_atod(const char *str, double *ret);
 SR_PRIV int sr_atof(const char *str, float *ret);