Re: __builtin_expect in 1.9.1

Peter Wächtler <[email protected]>
Newsgroups gmane.linux.ngpt.devel
Message-ID <[email protected]>
Peter Wächtler wrote:
> 
> I tried to compile ngpt-1.9.1 with gcc 2.95.3.
> 

Oh, found a better patch:

just include <linux/compiler.h> in shm_open.c ;-)



#ifndef __LINUX_COMPILER_H
#define __LINUX_COMPILER_H

/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
    a mechanism by which the user can annotate likely branch directions and
    expect the blocks to be reordered appropriately.  Define __builtin_expect
    to nothing for earlier compilers.  */

#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
#define __builtin_expect(x, expected_value) (x)
#endif

#define likely(x)       __builtin_expect((x),1)
#define unlikely(x)     __builtin_expect((x),0)

#endif /* __LINUX_COMPILER_H */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.