[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#175025: dev_t problems with non-gcc compilers



On Thu, 2003-01-02 at 16:07, Ben Collins wrote:
> On Thu, Jan 02, 2003 at 03:56:14PM +0200, Timo Sirainen wrote:
> > On Thu, 2003-01-02 at 15:49, Ben Collins wrote:
> > > > sys/sysmacros.h seems to use different method to determine if dev_t is
> > > > unsigned long long or an array type than the actual dev_t declaration.
> > > > Here's a test program that fails with tcc (included with Debian):
> > > > 
> > > > #include <stdio.h>
> > > > #include <sys/types.h>
> > > > #include <sys/sysmacros.h>
> > > > 
> > > > int main(int argc, char *argv[])
> > > > {
> > > >         dev_t x = 0;
> > > > 
> > > >         printf("%d %d\n", major(x), minor(x));
> > > >         return 0;
> > > > }
> > > > 
> > > > Results as:
> > > 
> > > Shouldn't "dev_t x = 0" be:
> > > 
> > > 	dev_t x = makedev(0,0);
> > > 
> > > ? I think that's your problem, not a header bug. Of course, it all
> > > depends on what line is line 9.
> > 
> > Well, the = 0 wasn't important, major() and minor() were. Using
> > makedev() also fails:
> 
> The only way I can see that as possible is if tcc defines __GNUC__.

Well, I see it the other way :) Using the __GNUC__ macros from
sysmacros.h makes it work. dev_t declarations seems to be:

// bits/types.h
typedef __DEV_T_TYPE __dev_t;	/* Type of device numbers.  */

// bits/typesizes.h
#define __DEV_T_TYPE		__UQUAD_TYPE

// bits/types.h
/* Here we assume what is presently the case in all the GCC configurations
   we support: long long is always 64 bits, ... */
#define	__UQUAD_TYPE		unsigned long long int

ie. always long long. sysmacros.h is then just out of date with it's
checks?

> Can
> you get the preprocessed output before tcc gets it and see what dev_t is
> typedef'd to?

tcc doesn't do preprocessing separately.




Reply to: