[Libguestfs] -Woverlength-strings / assert unhelpful interaction
Richard W.M. Jones
rjones at redhat.com
Fri Feb 5 11:45:21 UTC 2010
$ gcc -O2 -c -Woverlength-strings stupid.c
stupid.c: In function ‘insert_lf_record’:
stupid.c:22: warning: string length ‘7394’ is greater than the length ‘509’ ISO C90 compilers are required to support
Without -O2 the error message goes away.
Even ISO C99 compilers don't help - they raise the limit to a mere
4095 bytes.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
-------------- next part --------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
struct hive_h {
void *addr;
};
struct ntreg_hbin_block {
char id[2];
};
typedef size_t hive_node_h;
#define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0)
#define BLOCK_ID_EQ(h,offs,eqid) \
(STREQLEN (((struct ntreg_hbin_block *)((h)->addr + (offs)))->id, (eqid), 2))
static size_t
insert_lf_record (struct hive_h *h, size_t old_offs, size_t posn,
const char *name, hive_node_h node)
{
assert (BLOCK_ID_EQ (h, old_offs, "lf") || BLOCK_ID_EQ (h, old_offs, "lh"));
}
More information about the Libguestfs
mailing list