--- /dev/null
+#include "strutil.h"
+
+
+int strcmp_underscore(const char *const s1, const char *const s2)
+{
+ if (s2[0] == '_' && s2[1] == '_') {
+ size_t len2 = strlen(s2);
+ size_t len1 = strlen(s1);
+ if (len1 == len2 - 4 && s2[len2 - 2] == '_' && s2[len2 - 1] == '_') {
+ return strncmp(s1, s2 + 2, len2 - 4);
+ }
+ }
+
+ return strcmp(s1, s2);
+}
return NULL;
}
+/**
+ * compare two strings, ignoring double underscores on the second.
+ */
+int strcmp_underscore(const char *s1, const char *s2);
+
#endif
#include <config.h>
#include <assert.h>
+#include "adt/strutil.h"
#include "diagnostic.h"
#include "warning.h"
#include "attribute_t.h"
return attribute_names[kind];
}
-/**
- * compare two string, ignoring double underscores on the second.
- */
-static int strcmp_underscore(const char *s1, const char *s2)
-{
- if (s2[0] == '_' && s2[1] == '_') {
- size_t len2 = strlen(s2);
- size_t len1 = strlen(s1);
- if (len1 == len2-4 && s2[len2-2] == '_' && s2[len2-1] == '_') {
- return strncmp(s1, s2+2, len2-4);
- }
- }
-
- return strcmp(s1, s2);
-}
-
type_t *handle_attribute_mode(const attribute_t *attribute, type_t *orig_type)
{
type_t *type = skip_typeref(orig_type);
#include <stdarg.h>
#include <stdbool.h>
+#include "adt/strutil.h"
#include "parser.h"
#include "diagnostic.h"
#include "format_check.h"
return result;
}
-/**
- * compare two string, ignoring double underscores on the second.
- */
-static int strcmp_underscore(const char *s1, const char *s2)
-{
- if (s2[0] == '_' && s2[1] == '_') {
- size_t len2 = strlen(s2);
- size_t len1 = strlen(s1);
- if (len1 == len2-4 && s2[len2-2] == '_' && s2[len2-1] == '_') {
- return strncmp(s1, s2+2, len2-4);
- }
- }
-
- return strcmp(s1, s2);
-}
-
static attribute_t *allocate_attribute_zero(attribute_kind_t kind)
{
attribute_t *attribute = allocate_ast_zero(sizeof(*attribute));