Messages in this thread | | | Date | Thu, 1 Jul 1999 20:29:31 -0400 | From | Arvind Sankar <> | Subject | Re: linux headers and C++ |
| |
On Thu, Jul 01, 1999 at 05:52:04PM -0400, Richard B. Johnson wrote: > On Thu, 1 Jul 1999, Ronnie G Misra wrote: > > > I'm trying to build a kernel module in C++. This code includes some of > > the linux kernel header files, and unfortunately does not compile with > > recent versions of the kernel. The code is not my own - I have > > inherited it from someone else - but I am assured that it used to > > compile. > > > > The error I get has to do with include/linux/signal.h under the kernel > > source tree: the functions siginitset and siginitsetinv both contain > > switch statements which are invalid C++ syntax (and in fact, are > > invalid in C, but which make use of a gcc extension). Specifically, > > the last label ("case 1:") in these statements should be followed by a > > semicolon. > > > > Err Lines 137 thru 190... > > switch (_NSIG_WORDS) { > default: > memset(&set->sig[1], -1, sizeof(long)*(_NSIG_WORDS-1)); > break; > case 2: set->sig[1] = -1; > case 1: > } > > ... seems okay to me. > > case 1: falls off the end of the switch which is legal in 'C'. > > To make this more clear. Observe: > > switch(foo) > { > case 0: > case 1: > case 2: > default: > } > > This is basically a NOP. Perfectly legal (and useless). > > Your code might not compile because some "include" file, necessary > to make some macros in this header make sense, probably was not included. >
Read the chap's mail again. He knows exactly what is wrong. IMHO, the include file should be fixed.
-- arvind
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |