Bug 67215

Summary: both "#if " and "#ifdef " used on FLOATING_STACKS
Product: [Retired] Red Hat Linux Reporter: John Reiser <jreiser>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: fweimer, linchen
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-06-21 03:31:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Reiser 2002-06-21 03:31:47 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.2.19-6.2.16-KRUD-perfctr2.3.6
i586)

Description of problem:
The source for glibc-2.2.5-34/linuxthreads uses both "#if " and
"#ifdef " to test FLOATING_STACKS.  Although current usage may
be OK, using both forms on the same symbol encourages bugs during maintenance.

manager.c uses "#if "; all other files use "#ifdef ".



Version-Release number of selected component (if applicable):
glibc-2.2.5-34

How reproducible:
Always

Steps to Reproduce:
1. examine source in linuxthreads subdirectory and below.
2.
3.
	

Actual Results:  $ cd glibc-2.2.5-34/linuxthreads
$ grep FLOATING_STACKS *.c
attr.c:#ifdef FLOATING_STACKS
manager.c:#if FLOATING_STACKS
manager.c:#if defined USE_TLS && !FLOATING_STACKS
manager.c:#if FLOATING_STACKS
manager.c:#else /* !FLOATING_STACKS */
manager.c:#endif   /* !FLOATING_STACKS */
pthread.c:#ifdef FLOATING_STACKS
pthread.c:#ifdef FLOATING_STACKS
tst-context.c:#ifdef FLOATING_STACKS
tst-context.c:#ifdef FLOATING_STACKS
tst-context.c:#ifndef FLOATING_STACKS
$ 

$ grep FLOATING_STACKS $(find . -name '*.h')
./internals.h:#ifdef FLOATING_STACKS
./sysdeps/alpha/pt-machine.h:#define FLOATING_STACKS 1
./sysdeps/i386/tls.h:#if defined FLOATING_STACKS && defined HAVE_TLS_SUPPORT
./sysdeps/i386/tls.h:#endif	/* FLOATING_STACKS && HAVE_TLS_SUPPORT */
./sysdeps/i386/useldt.h:#define FLOATING_STACKS	1
./sysdeps/ia64/pt-machine.h:#define FLOATING_STACKS 1
./sysdeps/s390/s390-32/pt-machine.h:#define FLOATING_STACKS 1
./sysdeps/s390/s390-64/pt-machine.h:#define FLOATING_STACKS 1
./sysdeps/sh/pt-machine.h:#define FLOATING_STACKS 1
./sysdeps/sh/tls.h:#if defined FLOATING_STACKS && defined HAVE_TLS_SUPPORT
./sysdeps/sh/tls.h:#endif	/* FLOATING_STACKS && HAVE_TLS_SUPPORT */
./sysdeps/sparc/sparc32/pt-machine.h:#define FLOATING_STACKS 1
./sysdeps/sparc/sparc64/pt-machine.h:#define FLOATING_STACKS 1
./sysdeps/x86_64/pt-machine.h:#define FLOATING_STACKS	1
$ 


Expected Results:  FLOATING_THREADS should be #define as 0 or 1 always,
and all conditional compilation tests should be "#if "
(and not "#ifdef ").

Additional info:

Comment 1 Jakub Jelinek 2002-06-21 14:45:26 UTC
I don't think this causes any problems. Unless someone adds
#define FLOATING_STACKS 0
there is no difference, and there is no reason why someone would be adding it.

Comment 2 lin chen 2005-09-01 15:55:13 UTC
Which part controls if floating_stack use used, the application or the 
library ?

Comment 3 John Reiser 2005-09-01 17:38:29 UTC
The person [build system] who configures and builds the glibc package controls
the  #define.  I believe that it matters only a package build time: after the
glibc package has been installed, then the application has no choice.