Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 549754 - sys-libs/glibc: unistd.h uses intptr_t without including stdint.h
Summary: sys-libs/glibc: unistd.h uses intptr_t without including stdint.h
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal major
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 531268
  Show dependency tree
 
Reported: 2015-05-17 21:11 UTC by Michael Trinque
Modified: 2015-05-18 02:07 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Trinque 2015-05-17 21:11:47 UTC
This was discovered by running into a broken dieharder:
https://bugs.gentoo.org/show_bug.cgi?id=531268

Reproducible: Always

Steps to Reproduce:
emerge =app-crypt/dieharder-3.31.1
Actual Results:  
make[1]: Entering directory '/var/tmp/portage/app-crypt/dieharder-3.31.1/work/dieharder-3.31.1/libdieharder'
/bin/sh ../libtool  --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..  -DVERSION=3.31.1 -DLITTLE_ENDIAN=1 -I ../include -I /usr/include  -std=c99 -Wall -pedantic -O2 -pipe -c -o libdieharder_la-bits.lo `test -f 'bits.c' || echo './'`bits.c
libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -DVERSION=3.31.1 -DLITTLE_ENDIAN=1 -I ../include -I /usr/include -std=c99 -Wall -pedantic -O2 -pipe -c bits.c  -fPIC -DPIC -o .libs/libdieharder_la-bits.o
In file included from ../include/dieharder/libdieharder.h:22:0,
                 from bits.c:7:
/usr/include/unistd.h:1043:20: error: unknown type name 'intptr_t'
 extern void *sbrk (intptr_t __delta) __THROW;
                    ^
bits.c: In function 'fill_uint_buffer':
bits.c:407:15: warning: variable 'bufbits' set but not used [-Wunused-but-set-variable]
  unsigned int bufbits,bdelta;
               ^
Makefile:570: recipe for target 'libdieharder_la-bits.lo' failed
make[1]: *** [libdieharder_la-bits.lo] Error 1
make[1]: Leaving directory '/var/tmp/portage/app-crypt/dieharder-3.31.1/work/dieharder-3.31.1/libdieharder'
Makefile:412: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
 * ERROR: app-crypt/dieharder-3.31.1::gentoo failed (compile phase):
 *   emake failed

Expected Results:  
Successful build of dieharder.
Comment 1 Alon Bar-Lev (RETIRED) gentoo-dev 2015-05-17 21:31:49 UTC
better to create a test case detached from this dieharder.

when is exactly (conditional) the intptr_t used?

write a simple main.c which defines some macros, #include <unitstd.h> to reproduce.
Comment 2 Michael Trinque 2015-05-17 21:59:33 UTC
I have narrowed it down to the following test case:

# main.c

#include <stdio.h>
#define __USE_MISC 1
#include <unistd.h>

int main() {
    return 0;
}

# compilation
% gcc -std=c99 -o main main.c
In file included from main.c:3:0:
/usr/include/unistd.h:1043:20: error: unknown type name ‘intptr_t’
 extern void *sbrk (intptr_t __delta) __THROW;
Comment 3 Michael Trinque 2015-05-17 22:00:14 UTC
Compilation succeeds without -std=c99
Comment 4 SpanKY gentoo-dev 2015-05-18 02:07:28 UTC
(In reply to Michael Trinque from comment #2)

your use case is invalid.  applications must *never* define __USE_xxx directly.