S
Subra
Hi,
in a cpp file we are including <cstdlib> and indirectly including
<stdlib.h>. But the definition for "strtoll" is not appearing in
the .ii file generated using the -E option to gcc.
snippet of .ii file
=========================================
# 307 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h" 2
# 358 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h"
# 1 "/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include/stddef.h" 1 3 4
# 359 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h" 2
# 371 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h"
# 1 "/vobs/publish_linux_vob/publish_linux/include/pin_os_string.h" 1
# 14 "/vobs/publish_linux_vob/publish_linux/include/pin_os_string.h"
# 1 "/usr/include/stdlib.h" 1 3 4
# 33 "/usr/include/stdlib.h" 3 4
# 1 "/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include/stddef.h" 1 3 4
# 34 "/usr/include/stdlib.h" 2 3 4
extern "C" {
# 1 "/usr/include/bits/waitflags.h" 1 3 4
# 43 "/usr/include/stdlib.h" 2 3 4
# 1 "/usr/include/bits/waitstatus.h" 1 3 4
# 65 "/usr/include/bits/waitstatus.h" 3
:
:
:
:
:
# 140 "/usr/include/stdlib.h" 3 4
extern size_t __ctype_get_mb_cur_max (void) throw ();
extern double atof (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));
extern int atoi (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));
extern long int atol (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));
__extension__ extern long long int atoll (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));
extern double strtod (__const char *__restrict __nptr,
char **__restrict __endptr) throw () __attribute__
((__nonnull__ (1)));
extern float strtof (__const char *__restrict __nptr,
char **__restrict __endptr) throw () __attribute__
((__nonnull__ (1)));
extern long double strtold (__const char *__restrict __nptr,
char **__restrict __endptr)
throw () __attribute__ ((__nonnull__ (1)));
extern long int strtol (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
extern unsigned long int strtoul (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
__extension__
extern unsigned long long int strtouq (__const char *__restrict
__nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
__extension__
extern unsigned long long int strtoull (__const char *__restrict
__nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
# 239 "/usr/include/stdlib.h" 3 4
extern long int strtol_l (__const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 4)));
extern unsigned long int strtoul_l (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
throw () __attribute__ ((__nonnull__ (1, 4)));
__extension__
extern long long int strtoll_l (__const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc)
throw () __attribute__ ((__nonnull__ (1, 4)));
__extension__
extern unsigned long long int strtoull_l (__const char *__restrict
__nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
:
:
:
:
==============================================
Command used to generate the .ii file
gcc -c -I/vobs/rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32 -I/vobs/
rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32/include -I../../
include -I/vobs/publish_linux_vob/publish_linux/include -I. -I./
include -I../include -DOS_VER=linux_2.6.9-42.0.0.0.1.ELsmp -
DPIN_USE_ANSI_HDRS -D_REENTRANT -D__unix -D__linux -Dlinux -D__linux__
-DLITTLE_ENDIAN -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -
D_GLIBC_HAVE_LONG_LONG -D__USE_MISC -DLINUX -Dx86 -Dx86_64 -pthread -
Wall -Wno-unused -fPIC -Wno-ctor-dtor-privacy -Wno-reorder -
DINC_TEMPL_DEFS=1 -fpermissive -m32 -g -D_PIN_DEBUG -D_DEBUG -DPUBLIC=
-D_PCM_OPS_H -DTRACE -DRWDEBUG=1 -D_RWSTD_MINIMUM_NEW_CAPACITY=4 -
D_RWSTD_NEW_CAPACITY_RATIO=1.1 -D_RWSTD_MINIMUM_STRING_CAPACITY=16 -
DRW_MULTI_THREAD -DRWSTD_MULTI_THREAD -DRWTRACE=0 -
DRW_USER_TRACE_LEVEL=0 -D_RWCONFIG_15d -DRWLIBVERSION="15d" -
DRW_THR_OS_VERSION_LINUX=0x02609 -
DRW_THR_COMPILER_VERSION_GCC=0x00030404 -D__USE_ISOC99 -E -o
ProcTimeCounteR1.II ProcTimeCounter.cpp
In stdlib.h I can see the code like
=============================================
#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined
__USE_MISC)
__BEGIN_NAMESPACE_C99
/* Convert a string to a quadword integer. */
__extension__
extern long long int strtoll (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1));
=============================================
So i am using -D__USE_ISOC99 in my compile command. Still its not
working... Please let me know what could be the problem.
PS: If I include the <stdlib.h> directly into the cpp source file its
working. But I am not sure why it is not including the definition from
the indirectly included <stdlib.h>
in a cpp file we are including <cstdlib> and indirectly including
<stdlib.h>. But the definition for "strtoll" is not appearing in
the .ii file generated using the -E option to gcc.
snippet of .ii file
=========================================
# 307 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h" 2
# 358 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h"
# 1 "/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include/stddef.h" 1 3 4
# 359 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h" 2
# 371 "/vobs/publish_linux_vob/publish_linux/include/pin_type.h"
# 1 "/vobs/publish_linux_vob/publish_linux/include/pin_os_string.h" 1
# 14 "/vobs/publish_linux_vob/publish_linux/include/pin_os_string.h"
# 1 "/usr/include/stdlib.h" 1 3 4
# 33 "/usr/include/stdlib.h" 3 4
# 1 "/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include/stddef.h" 1 3 4
# 34 "/usr/include/stdlib.h" 2 3 4
extern "C" {
# 1 "/usr/include/bits/waitflags.h" 1 3 4
# 43 "/usr/include/stdlib.h" 2 3 4
# 1 "/usr/include/bits/waitstatus.h" 1 3 4
# 65 "/usr/include/bits/waitstatus.h" 3
:
:
:
:
:
# 140 "/usr/include/stdlib.h" 3 4
extern size_t __ctype_get_mb_cur_max (void) throw ();
extern double atof (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));
extern int atoi (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));
extern long int atol (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));
__extension__ extern long long int atoll (__const char *__nptr)
throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__
(1)));
extern double strtod (__const char *__restrict __nptr,
char **__restrict __endptr) throw () __attribute__
((__nonnull__ (1)));
extern float strtof (__const char *__restrict __nptr,
char **__restrict __endptr) throw () __attribute__
((__nonnull__ (1)));
extern long double strtold (__const char *__restrict __nptr,
char **__restrict __endptr)
throw () __attribute__ ((__nonnull__ (1)));
extern long int strtol (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
extern unsigned long int strtoul (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
__extension__
extern unsigned long long int strtouq (__const char *__restrict
__nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
__extension__
extern unsigned long long int strtoull (__const char *__restrict
__nptr,
char **__restrict __endptr, int __base)
throw () __attribute__ ((__nonnull__ (1)));
# 239 "/usr/include/stdlib.h" 3 4
extern long int strtol_l (__const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 4)));
extern unsigned long int strtoul_l (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
throw () __attribute__ ((__nonnull__ (1, 4)));
__extension__
extern long long int strtoll_l (__const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc)
throw () __attribute__ ((__nonnull__ (1, 4)));
__extension__
extern unsigned long long int strtoull_l (__const char *__restrict
__nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
:
:
:
:
==============================================
Command used to generate the .ii file
gcc -c -I/vobs/rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32 -I/vobs/
rw_rls_unix_vob/rw_rls_unix/ed9/linux_gcc346_32/include -I../../
include -I/vobs/publish_linux_vob/publish_linux/include -I. -I./
include -I../include -DOS_VER=linux_2.6.9-42.0.0.0.1.ELsmp -
DPIN_USE_ANSI_HDRS -D_REENTRANT -D__unix -D__linux -Dlinux -D__linux__
-DLITTLE_ENDIAN -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -
D_GLIBC_HAVE_LONG_LONG -D__USE_MISC -DLINUX -Dx86 -Dx86_64 -pthread -
Wall -Wno-unused -fPIC -Wno-ctor-dtor-privacy -Wno-reorder -
DINC_TEMPL_DEFS=1 -fpermissive -m32 -g -D_PIN_DEBUG -D_DEBUG -DPUBLIC=
-D_PCM_OPS_H -DTRACE -DRWDEBUG=1 -D_RWSTD_MINIMUM_NEW_CAPACITY=4 -
D_RWSTD_NEW_CAPACITY_RATIO=1.1 -D_RWSTD_MINIMUM_STRING_CAPACITY=16 -
DRW_MULTI_THREAD -DRWSTD_MULTI_THREAD -DRWTRACE=0 -
DRW_USER_TRACE_LEVEL=0 -D_RWCONFIG_15d -DRWLIBVERSION="15d" -
DRW_THR_OS_VERSION_LINUX=0x02609 -
DRW_THR_COMPILER_VERSION_GCC=0x00030404 -D__USE_ISOC99 -E -o
ProcTimeCounteR1.II ProcTimeCounter.cpp
In stdlib.h I can see the code like
=============================================
#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined
__USE_MISC)
__BEGIN_NAMESPACE_C99
/* Convert a string to a quadword integer. */
__extension__
extern long long int strtoll (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1));
=============================================
So i am using -D__USE_ISOC99 in my compile command. Still its not
working... Please let me know what could be the problem.
PS: If I include the <stdlib.h> directly into the cpp source file its
working. But I am not sure why it is not including the definition from
the indirectly included <stdlib.h>