]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Define macros in a special way if gcc is not used and so dev_t is an
authorUlrich Drepper <drepper@redhat.com>
Mon, 25 Aug 1997 20:47:28 +0000 (20:47 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 25 Aug 1997 20:47:28 +0000 (20:47 +0000)
array.

sysdeps/unix/sysv/linux/sys/sysmacros.h

index 85b1b85d2eb0893d8a2d56370469178fe3f90180..55486feb3ee80a189be880017a8b31f25b1e30a0 100644 (file)
 
 #define _SYS_SYSMACROS_H       1
 
-/* For compatibility we provide alternative names.  */
-#define major(dev) (((dev) >> 8) & 0xff)
-#define minor(dev) ((dev) & 0xff)
-#define makedev(major, minor) (((major) << 8) | (minor))
+/* For compatibility we provide alternative names.
+
+   The problem here is that compilers other than GCC probably don't
+   have the `long long' type and so `dev_t' is actually an array.  */
+#if defined __GNUC__ && __GNUC__ >= 2
+# define major(dev) ((int)(((dev) >> 8) & 0xff))
+# define minor(dev) ((int)((dev) & 0xff))
+# define makedev(major, minor) (((major) << 8) | (minor))
+#else
+# define major(dev) (((dev).__val[0] >> 8) & 0xff)
+# define minor(dev) ((dev).__val[0] & 0xff)
+# define makedev(major, minor) { (((major) << 8) | (minor)), 0 }
+#endif
 
 #endif /* _SYS_SYSMACROS_H */