handle Block_entity like other node attributes
[libfirm] / ir / libcore / lc_opts.c
index 34deeda..665398a 100644 (file)
 #include <string.h>
 #include <ctype.h>
 
-#ifdef _WIN32
-#include <malloc.h>
-#endif
-
-/* Includes to determine user's home directory */
-#ifdef _WIN32
-#include <shlobj.h>
-#else
-#include <sys/types.h>
-#include <unistd.h>
-#include <pwd.h>
-#endif
-
-/* maximum length of a path. */
-#ifndef MAX_PATH
-#define MAX_PATH 2048
-#endif
-
-
-#include "lc_common_t.h"
 #include "lc_opts_t.h"
 #include "lc_opts_enum.h"
 #include "hashptr.h"
 #include "lc_printf.h"
+#include "util.h"
 #include "xmalloc.h"
+#include "obst.h"
 
 #define ERR_STRING "In argument \"%s\": "
 
@@ -354,15 +336,16 @@ static char *strtolower(char *buf, size_t n, const char *str)
 {
        unsigned i;
        for (i = 0; i < n; ++i)
-               buf[i] = tolower(str[i]);
+               buf[i] = tolower((unsigned char)str[i]);
        return buf;
 }
 
-int lc_opt_std_cb(UNUSED(const char *name), lc_opt_type_t type, void *data, size_t length, ...)
+int lc_opt_std_cb(const char *name, lc_opt_type_t type, void *data, size_t length, ...)
 {
        va_list args;
        int res = 0;
        int integer;
+       (void) name;
 
        va_start(args, length);
 
@@ -372,17 +355,17 @@ int lc_opt_std_cb(UNUSED(const char *name), lc_opt_type_t type, void *data, size
                case lc_opt_type_bit:
                        integer = va_arg(args, int);
                        if (integer)
-                               *((int *) data) |= length;
+                               *(unsigned*)data |= length;
                        else
-                               *((int *) data) &= ~length;
+                               *(unsigned*)data &= ~length;
                        break;
 
                case lc_opt_type_negbit:
                        integer = va_arg(args, int);
                        if (integer)
-                               *((int *) data) &= ~length;
+                               *(unsigned*)data &= ~length;
                        else
-                               *((int *) data) |= length;
+                               *(unsigned*)data |= length;
                        break;
 
                case lc_opt_type_boolean:
@@ -413,9 +396,11 @@ int lc_opt_std_cb(UNUSED(const char *name), lc_opt_type_t type, void *data, size
        return res;
 }
 
-int lc_opt_std_dump(char *buf, size_t n, UNUSED(const char *name), lc_opt_type_t type, void *data, UNUSED(size_t length))
+int lc_opt_std_dump(char *buf, size_t n, const char *name, lc_opt_type_t type, void *data, size_t length)
 {
        int res;
+       (void) name;
+       (void) length;
 
        if (data) {
                switch (type) {
@@ -451,8 +436,12 @@ int lc_opt_std_dump(char *buf, size_t n, UNUSED(const char *name), lc_opt_type_t
        return res;
 }
 
-int lc_opt_bool_dump_vals(char *buf, size_t n, UNUSED(const char *name), UNUSED(lc_opt_type_t type), UNUSED(void *data), UNUSED(size_t length))
+int lc_opt_bool_dump_vals(char *buf, size_t n, const char *name, lc_opt_type_t type, void *data, size_t length)
 {
+       (void) name;
+       (void) type;
+       (void) data;
+       (void) length;
        strncpy(buf, "true, false", n);
        return n;
 }
@@ -516,7 +505,7 @@ int lc_opt_occurs(lc_opt_entry_t *opt, const char *value, lc_opt_err_info_t *err
                case lc_opt_type_bit:
                case lc_opt_type_negbit:
                                strtolower(buf, sizeof(buf), value);
-                               for (i = 0; i < LC_ARRSIZE(bool_strings); ++i) {
+                               for (i = 0; i < ARRAY_SIZE(bool_strings); ++i) {
                                        if (strcmp(buf, bool_strings[i].str) == 0) {
                                                val->integer = bool_strings[i].val;
                                                error = lc_opt_err_none;
@@ -802,8 +791,9 @@ int lc_opt_from_argv(const lc_opt_entry_t *root,
        return options_set;
 }
 
-static int opt_arg_type(UNUSED(const lc_arg_occ_t *occ))
+static int opt_arg_type(const lc_arg_occ_t *occ)
 {
+       (void) occ;
        return lc_arg_type_ptr;
 }