NetBSD-Bugs archive

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

lib/39215: getdevmajor()/major() types don't match

>Number:         39215
>Category:       lib
>Synopsis:       getdevmajor()/major() types don't match
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 27 06:05:00 +0000 2008
>Originator:     David A. Holland
>Release:        NetBSD 4.99.70 (20080727)
System: NetBSD valkyrie 4.99.69 NetBSD 4.99.69 (VALKYRIE) #30: Sun Jul 13 
10:21:49 EDT 2008 root@valkyrie:/usr/src/sys/arch/amd64/compile/VALKYRIE amd64
Architecture: x86_64
Machine: amd64

getdevmajor() returns dev_t, which is uint32_t.
major() generates an int32_t.

thus, code of the form

        if (major(dev) == getdevmajor(stuff)) {

generates a compiler warning unless you set -Wno-sign-compare.


compile lib/libc/gen/devname.c with -Wsign-compare enabled, among
other possibilities.


Probably changing major() (and minor(), for symmetry) to produce an
unsigned value is the path of least resistance... although who knows
what might break...

Home | Main Index | Thread Index | Old Index