https://github.com/torvalds/linux
Revision e4f34cf6d59160818dcdcf41f4116cc88093ece3 authored by Takashi Sakamoto on 05 January 2017, 00:41:31 UTC, committed by Takashi Iwai on 05 January 2017, 07:39:47 UTC
This reverts commit 6b7e95d1336b9eb0d4c6db190ce756480496bd13. This commit
is based on a concern about value of the given parameter. It's expected
to be ORed value with some enumeration-constants, thus often it can not be
one of the enumeration-constants. I understood that this is out of
specification and causes implementation-dependent issues.

In C language specification, enumerated type can be interpreted as an
integer type, in which all of enumeration-constants in corresponding
enumerator-list can be stored. Implementations can select one of char,
signed int and unsigned int as its type, and this selection is
implementation-dependent.

In GCC, a signed integer is selected when at least one of
enumeration-constants has negative value, else an unsigned integer is
selected. This behaviour can be switched by -fshort-enums to short type.
Anyway, the type can be decided after scanning all of
enumeration-constants.

Totally, there's no rules to constrain the value of enumerated type to
be one of enumeration-constants. In short, in enumerated type, decision
of actual type for the type is the most important and
enumeration-constants are just used for the decision, thus it's permitted
to have an integer value in a range of enumeration-constants. In our case,
actual type for the type is currently deterministic to be either char or
unsigned int. Under GCC, it's unsigned int.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 13a6c83
History
Tip revision: e4f34cf6d59160818dcdcf41f4116cc88093ece3 authored by Takashi Sakamoto on 05 January 2017, 00:41:31 UTC
Revert "ALSA: firewire-lib: change structure member with proper type"
Tip revision: e4f34cf
File Mode Size
Documentation
arch
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.cocciconfig -rw-r--r-- 59 bytes
.get_maintainer.ignore -rw-r--r-- 31 bytes
.gitattributes -rw-r--r-- 30 bytes
.gitignore -rw-r--r-- 1.3 KB
.mailmap -rw-r--r-- 7.5 KB
COPYING -rw-r--r-- 18.3 KB
CREDITS -rw-r--r-- 96.0 KB
Kbuild -rw-r--r-- 2.8 KB
Kconfig -rw-r--r-- 252 bytes
MAINTAINERS -rw-r--r-- 381.7 KB
Makefile -rw-r--r-- 57.6 KB
README -rw-r--r-- 722 bytes

README

back to top