Skip to content

[Linux kernel] static variable with forward declared type #4437

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 4065
Resolution WONTFIX
Resolved on Feb 22, 2010 12:47
Version unspecified
OS Linux
Blocks llvm/llvm-bugzilla-archive#4068
Attachments pre-processed source code
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@edwintorok,@efriedma-quic

Extended Description

The Linux kernel source code file kernel/sched.c builds fine with gcc, but fails under clang:

clang -MD -MF kernel/.sched.o.d -nostdinc -isystem include -Iinclude -I/spare/repo/linux-2.6/arch/x86/include -include include/linux/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2 -m64 -march=core2 -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wframe-larger-than=2048 -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg -Wdeclaration-after-statement -Wno-pointer-sign -fwrapv -fno-dwarf2-cfi-asm -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(sched)" -D"KBUILD_MODNAME=KBUILD_STR(sched)" -c -o kernel/sched.o kernel/sched.c
clang: warning: the clang compiler does not yet support '-pg'
warning: unknown warning option: -Wframe-larger-than=2048
kernel/sched.c:325:8: error: variable has incomplete type 'typeof(struct cfs_rq)' (aka 'struct cfs_rq')
static DEFINE_PER_CPU(struct cfs_rq, init_cfs_rq) ____cacheline_aligned_in_smp;
^
include/linux/percpu-defs.h:37:2: note: instantiated from:
DEFINE_PER_CPU_SECTION(type, name, "")
^
:44:1: note: instantiated from:
per_cpu__init_cfs_rq
^
In file included from kernel/sched.c:31:
In file included from include/linux/nmi.h:7:
include/linux/sched.h:144:8: note: forward declaration of 'struct cfs_rq'
struct cfs_rq;
^
kernel/sched.c:7760:21: warning: field of variable sized type 'sg' not at the end of a struct or class is a GNU extension
struct sched_group sg;
^
kernel/sched.c:7765:22: warning: field of variable sized type 'sd' not at the end of a struct or class is a GNU extension
struct sched_domain sd;
^
kernel/sched.c:8982:6: error: indirection requires pointer operand ('void' invalid)
&per_cpu(init_cfs_rq, i),
^~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/percpu.h:53:3: note: instantiated from:
(*SHIFT_PERCPU_PTR(&per_cpu_var(var), per_cpu_offset(cpu)))
^
5 diagnostics generated.
make[1]: *** [kernel/sched.o] Error 1
make: *** [kernel/] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclangClang issues not falling into any other categorywontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions