Another 4.3 c++ question.... (vmware kernel g++ module rebuild issue)
Tom London
selinux at gmail.com
Wed Feb 13 14:53:48 UTC 2008
vmware module rebuild fails with kernel-2.6.25-0.35.rc1.fc9.i686 (and
gcc-c++-4.3.0-0.7.i386?).
The following code from <asm/page.h> compiles fine with gcc but not with g++:
typedef int pteval_t;
struct pte_t {
pteval_t pte;
int junk;
};
typedef struct pte_t pte_t;
static inline pte_t native_make_pte(pteval_t val)
{
return (pte_t) { .pte = val };
}
[tbl at localhost ~]$ g++ -S t.c
t.c: In function 'pte_t native_make_pte(pteval_t)':
t.c:12: error: expected primary-expression before ')' token
t.c:12: error: expected ';' before '{' token
t.c:12: error: expected primary-expression before '.' token
t.c:12: error: expected `;' before '}' token
Has 4.3 g++ changed the acceptability of the "designated initializer"
in the return?
Changing the "dot =" to (obsolete?) "colon" appears acceptable:
static inline pte_t native_make_pte(pteval_t val)
{
return (pte_t) { pte:val };
}
There is a similar construct in <asm/paravirt.h> :
static inline pte_t __pte(pteval_t val)
{
pteval_t ret;
if (sizeof(pteval_t) > sizeof(long))
ret = PVOP_CALL2(pteval_t,
pv_mmu_ops.make_pte,
val, (u64)val >> 32);
else
ret = PVOP_CALL1(pteval_t,
pv_mmu_ops.make_pte,
val);
return (pte_t) { .pte = ret };
}
Changing to "colon" makes g++ happy.
This an issue with VMware? g++? headers? other?
tom
--
Tom London
More information about the fedora-devel-list
mailing list