Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Fix service_idle_exit build issue with -Werror=maybe-unitialized#5463

Merged
michaelrsweet merged 1 commit into
apple:masterfrom
OdyX:fix-unitialized-service-idle-exit
Dec 14, 2018
Merged

Fix service_idle_exit build issue with -Werror=maybe-unitialized#5463
michaelrsweet merged 1 commit into
apple:masterfrom
OdyX:fix-unitialized-service-idle-exit

Conversation

@OdyX

@OdyX OdyX commented Dec 14, 2018

Copy link
Copy Markdown
Contributor

There's only one line that makes the build fail under -Werror=maybe-unitialized :

Compiling listen.c...
cc  -fPIC -g -fstack-protector -D_GNU_SOURCE -I.. -D_CUPS_SOURCE -isystem /usr/include/mit-krb5 -Wdate-time -D_FORTIFY_SOURCE=2 -isystem /usr/include/mit-krb5 -g -O2 -fdebug-prefix-map=/tmp/reprotest.wwqjgR/const_build_path=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/libusb-1.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -DDBUS_API_SUBJECT_TO_CHANGE -D_FORTIFY_SOURCE=2 -D_REENTRANT -I/usr/include/p11-kit-1 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT  -Werror -Wno-error=deprecated-declarations -Wall -Wno-format-y2k -Wunused -Wno-unused-result -Wsign-conversion -Wno-format-truncation -Wno-tautological-compare -c -o listen.o listen.c
main.c: In function ‘main’:
main.c:942:14: error: ‘service_idle_exit’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (!fds && service_idle_exit)
              ^~

It should be initialized to 0, right?

@michaelrsweet michaelrsweet self-assigned this Dec 14, 2018
@michaelrsweet michaelrsweet added this to the CUPS 2.3.x milestone Dec 14, 2018
@michaelrsweet

Copy link
Copy Markdown
Contributor

Gotta love GCC for being honest about not being sure about their warnings... :/

Initializing service_idle_exit to 0 is a safe enough, if unnecessary, change.

@michaelrsweet michaelrsweet merged commit 59e5714 into apple:master Dec 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants