error compiling butch[1]
rofl0r opened this issue · 2 comments
rofl0r commented
butch.c:512:18: error: Initialisation expression '&(stringptr){ ("#!/bin/sh\n%BUTCH_CONFIG\nexport butch_package_name=%BUTCH_PACKAGE_NAME\nbutch_cache_dir="$C"\nwget -O "$butch_cache_dir/%BUTCH_TARBALL" '%BUTCH_MIRROR_URL'\n"), (sizeof("#!/bin/sh\n%BUTCH_CONFIG\nexport butch_package_name=%BUTCH_PACKAGE_NAME\nbutch_cache_dir="$C"\nwget -O "$butch_cache_dir/%BUTCH_TARBALL" '%BUTCH_MIRROR_URL'\n") - 1) }' is not constant
[1] https://github.com/rofl0r/butch
tarball with embedded dependencies and portable Makefile is available here https://github.com/downloads/rofl0r/butch/butch-0.1.5.tar.bz2 (62KB)
btw, this test program here works
typedef struct str_struct {
char *s;
unsigned long l;
} str;
#define STRLIT(A) &(str) { (A), sizeof((A) - 1) }
str *test(void) {
return STRLIT("test");
}
rofl0r commented
here is a testcase that can reproduce the bug
typedef struct str_struct {
char *s;
unsigned long l;
} str;
#define STRLIT(A) &(str) { (A), sizeof((A) - 1) }
enum foo {
FOO = 0,
BAR,
BAZ
};
const str *arr[BAZ] = {
[FOO] = STRLIT("foo"),
[BAR] = STRLIT("bar"),
};