[Ltrace-devel] [PATCH] initialize arg_type_prototypes properly to fix compiler with gcc33
Olaf Hering
olh at suse.de
Mon Oct 8 14:24:43 UTC 2007
ltrace does not build with the gcc-3_3-hammer branch.
I'm not sure how to fix the local variables in arg_align properly, so I
made them global.
read_config_file.c:55: warning: missing initializer
read_config_file.c:55: warning: (near initialization for `arg_type_prototypes[0].u')
...
read_config_file.c: In function `arg_align':
read_config_file.c:314: error: initializer element is not constant
...
---
read_config_file.c | 58 ++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 29 deletions(-)
--- a/read_config_file.c
+++ b/read_config_file.c
@@ -51,27 +51,27 @@ static struct list_of_pt_t {
* array must exactly match the list of enumerated values in
* ltrace.h */
static arg_type_info arg_type_prototypes[] = {
- { ARGTYPE_VOID },
- { ARGTYPE_INT },
- { ARGTYPE_UINT },
- { ARGTYPE_LONG },
- { ARGTYPE_ULONG },
- { ARGTYPE_OCTAL },
- { ARGTYPE_CHAR },
- { ARGTYPE_SHORT },
- { ARGTYPE_USHORT },
- { ARGTYPE_FLOAT },
- { ARGTYPE_DOUBLE },
- { ARGTYPE_ADDR },
- { ARGTYPE_FILE },
- { ARGTYPE_FORMAT },
- { ARGTYPE_STRING },
- { ARGTYPE_STRING_N },
- { ARGTYPE_ARRAY },
- { ARGTYPE_ENUM },
- { ARGTYPE_STRUCT },
- { ARGTYPE_POINTER },
- { ARGTYPE_UNKNOWN }
+ { .type = ARGTYPE_VOID, },
+ { .type = ARGTYPE_INT, },
+ { .type = ARGTYPE_UINT, },
+ { .type = ARGTYPE_LONG, },
+ { .type = ARGTYPE_ULONG, },
+ { .type = ARGTYPE_OCTAL, },
+ { .type = ARGTYPE_CHAR, },
+ { .type = ARGTYPE_SHORT, },
+ { .type = ARGTYPE_USHORT, },
+ { .type = ARGTYPE_FLOAT, },
+ { .type = ARGTYPE_DOUBLE, },
+ { .type = ARGTYPE_ADDR, },
+ { .type = ARGTYPE_FILE, },
+ { .type = ARGTYPE_FORMAT,},
+ { .type = ARGTYPE_STRING,},
+ { .type = ARGTYPE_STRING_N,},
+ { .type = ARGTYPE_ARRAY,},
+ { .type = ARGTYPE_ENUM,},
+ { .type = ARGTYPE_STRUCT,},
+ { .type = ARGTYPE_POINTER,},
+ { .type = ARGTYPE_UNKNOWN,}
};
arg_type_info *lookup_prototype(enum arg_type at)
@@ -298,16 +298,16 @@ static size_t arg_sizeof(arg_type_info *
}
#undef alignof
-#define alignof(field,st) ((size_t) ((char*) &st.field - (char*) &st))
+#define alignof(field,st) ((size_t) ((char*) &st.field - (char*) &st.c))
+static struct { char c; char C; } cC;
+static struct { char c; short s; } cs;
+static struct { char c; int i; } ci;
+static struct { char c; long l; } cl;
+static struct { char c; void* p; } cp;
+static struct { char c; float f; } cf;
+static struct { char c; double d; } cd;
static size_t arg_align(arg_type_info * arg)
{
- struct { char c; char C; } cC;
- struct { char c; short s; } cs;
- struct { char c; int i; } ci;
- struct { char c; long l; } cl;
- struct { char c; void* p; } cp;
- struct { char c; float f; } cf;
- struct { char c; double d; } cd;
static size_t char_alignment = alignof(C, cC);
static size_t short_alignment = alignof(s, cs);
More information about the Ltrace-devel
mailing list