Re: include file problem (with patch)

From: S. Baker (sbaker@erols.com)
Date: Sun Jun 04 2000 - 21:30:02 EST


Claiming that a bug is a feature is an interesting position, but
this is still a bug. You should look closer at the problem, for a
better understanding of what is going on. I fully understand
that inline functions don't get compiled without optimization.
What I also understand, and I think you missed, is that when
optimization is NOT turned on, the include file resolves the
functions in question down to an inline function: This is an
ERROR. When optimization is not turned on, these functions
should not be resolved to an inline function.

You should also look closer at the change I submitted. You
incorrectly state that my change will make the kernel slower.
The part of the include file I changed is NEVER compiled into
the kernel, for two reasons: 1. If you compile with optimization, the
part I changed is not used. The kernel is compiled with optimization.
2. If you compile without optimization, and try to use this include
file, the compilation will bomb with an error. Try the test program
I included.

I never dreamed it would be so difficult to get a simple little
problem like this fixed. I understand it isn't an important problem
like the memory issues that have been big, but frequently little
problems contribute to big problems, and little stuff like this
needs to get fixed too.

Can someone tell me who actually takes care of this particular
include file, and would be the person responsible for putting in
this patch?

Thanks,

S. Baker
bakers@erols.com

In article <fa.g5ksu5v.1h74ga0@ifi.uio.no>,
  "Khimenko Victor" <khim@sch57.msk.ru> wrote:
> In <Pine.LNX.4.21.0005282057560.11765-200000@studebaker.erols.com> S.
Baker (sbaker@erols.com) wrote:
> > While trying to compile the following sample program using
> > 'gcc -o testbo testbo.c' I encountered a problem in
> > include/linux/byteorder/swab.h that causes testbo not to
> > compile.
>
> As it should.
>
> > testbo:
> > #include <asm/byteorder.h>
>
> > main()
> > {
> > int b;
> > __u32 y = 5;
>
> > b = __cpu_to_be32(y);
> > }
>
> > An interesting thing to note is that
> > gcc -O -o testbo testbo.c works fine, which I believe
> > is why this bug has gone undiscovered.
>
> It's not bug. It's feature. In fact even two features:
> 1. Any program with kernel header usage is broken by definition. If
it does
> not compile - it's program bug, not kernel one.
> 2. extern inline will be inlined ONLY when optimization is enabled -
do not
> even try to compile them without optimization (it's even in some
man pages).
>
> > The following is a patch to fix this erroneous behavior:
>
> The folliowing patch make kernel slower and solves non-existing
problem.
>
> > diff -rc linux/include/linux/byteorder/swab.h
patch/include/linux/byteorder/swab.h
> > *** linux/include/linux/byteorder/swab.h Mon May 15 17:06:32
2000
> > --- patch/include/linux/byteorder/swab.h Sun May 28 20:49:34
2000
> > ***************
> > *** 90,98 ****
> > ___swab64((x)) : \
> > __fswab64((x)))
> > #else
> > ! # define __swab16(x) __fswab16(x)
> > ! # define __swab32(x) __fswab32(x)
> > ! # define __swab64(x) __fswab64(x)
> > #endif /* OPTIMIZE */
>
> > --- 90,98 ----
> > ___swab64((x)) : \
> > __fswab64((x)))
> > #else
> > ! # define __swab16(x) ___swab16(x)
> > ! # define __swab32(x) ___swab32(x)
> > ! # define __swab64(x) ___swab64(x)
> > #endif /* OPTIMIZE */
>
> > --ATTACHMENT-- text file <patchfile>
> > Description: swab patch
>
> -
> 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/
>

-
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/



This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:20 EST