<asm/bitops.h>: __inline__ needed where inline found

<asm/bitops.h>: __inline__ needed where inline found

Post by Ian Jacks » Fri, 30 Jul 1993 01:35:46



<sys/sem.h> includes <asm/bitopts.h>.

However <asm/bitopts.h> doesn't compile with gcc -traditional
because it uses the keyword `inline' which is switched off when using
-traditional (or -ansi).

This prevents Perl from compiling with semaphore support.

The solution is to use the alternate keyword __inline__ instead.

Patch enclosed below, to 0.99pl10 + net2-e.
I don't have pl11 here so I can't check it against that.

Should the general include files be cribbing lots of stuff out of
linux/ and asm/ ?  That leaves the door open to this kind of thing,
because the kernel maintainters who write the linux/ and asm/ headers
don't necessarily expect their code to be compiled using -traditional
or -ansi (indeed, nowadays it will be compiled with g++!).

--- include/asm/bitops.h~       Tue Apr 13 19:46:00 1993

 struct __dummy { unsigned long a[100]; };
 #define ADDR (*(struct __dummy *) addr)

-extern inline int set_bit(int nr, void * addr)
+extern __inline__ int set_bit(int nr, void * addr)
 {
        unsigned char ok;

        return ok;
 }

-extern inline int clear_bit(int nr, void * addr)
+extern __inline__ int clear_bit(int nr, void * addr)
 {
        unsigned char ok;

  * This routine doesn't need to be atomic, but it's faster to code it
  * this way.
  */
-extern inline int test_bit(int nr, void * addr)
+extern __inline__ int test_bit(int nr, void * addr)
 {
        unsigned char ok;

  * C language equivalents written by Theodore Ts'o, 9/26/92
  */

-extern inline int set_bit(int nr,int * addr)
+extern __inline__ int set_bit(int nr,int * addr)
 {
        int     mask, retval;

        return retval;
 }

-extern inline int clear_bit(int nr, int * addr)
+extern __inline__ int clear_bit(int nr, int * addr)
 {
        int     mask, retval;

        return retval;
 }

-extern inline int test_bit(int nr, int * addr)
+extern __inline__ int test_bit(int nr, int * addr)
 {
        int     mask;

--

Olivetti Research Ltd, Old Addenbrookes Site, Trumpington St, Cambridge, UK;
Home: 35 Molewood Close, Cambridge, CB4 3SR; +44 223 327029.     +44 223 343333