I am compiling some code with Clang which needs to jump to a fixed address to perform a "syscall". These fixed addresses contain valid code. I noticed that this code produces a warning: typedef void (*exit_syscall_type) (int status) __attribute__((noreturn)); void _exit(int status) __attribute__ ((noreturn)); void _exit(int status) { ((exit_syscall_type)0x10000)(status); } This (seemingly equivalent) code does not: typedef void (*exit_syscall_type) (int status) __attribute__((noreturn)); void _exit(int status) __attribute__ ((noreturn)); void _exit(int status) { exit_syscall_type ptr = (exit_syscall_type)0x10000; ptr(status); } The warning produced is: warning: function declared 'noreturn' should not return [-Winvalid-noreturn] Is this discrepancy intentional? - David Meyer
On Fri, Sep 16, 2011 at 5:37 PM, David Meyer <pdox at google.com> wrote:> I am compiling some code with Clang which needs to jump to a fixed > address to perform a "syscall". These fixed addresses contain valid > code. > > I noticed that this code produces a warning: > > typedef void (*exit_syscall_type) (int status) __attribute__((noreturn)); > void _exit(int status) __attribute__ ((noreturn)); > void _exit(int status) { > ((exit_syscall_type)0x10000)(status); > } > > This (seemingly equivalent) code does not: > > typedef void (*exit_syscall_type) (int status) __attribute__((noreturn)); > void _exit(int status) __attribute__ ((noreturn)); > void _exit(int status) { > exit_syscall_type ptr = (exit_syscall_type)0x10000; > ptr(status); > } > > The warning produced is: > > warning: function declared 'noreturn' should not return [-Winvalid-noreturn] > > Is this discrepancy intentional?(cfe-dev would be a better place to ask this.) No, looks like a bug. And it looks like it actually got fixed recently; try a build from top-of-tree. -Eli
Seemingly Similar Threads
- make install libvirt v5.5.0 failed
- Changes to 'ADJCALLSTACK*' and 'callseq_*' between LLVM v4.0 and v5.0
- Running the test fails virnetmessagetest with libvirt 1.2.8
- Re: LIBVIRT-4.6.0 can't work with QEMU 3.0.0
- Re: [virt-tools-list] libvirt/virt-manager source integration with xen