Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some problematic compiler warnings in leon/ #86

Open
jengelh opened this issue Oct 15, 2022 · 4 comments
Open

Some problematic compiler warnings in leon/ #86

jengelh opened this issue Oct 15, 2022 · 4 comments

Comments

@jengelh
Copy link

jengelh commented Oct 15, 2022

cd src/leon; CFLAGS="-O2 -Wall -Werror=return-type" make
./src/cuprstab.c: In function ‘uPartnStabRefine’:
./src/cuprstab.c:304:1: error: no return statement in function returning non-void [-Werror=return-type]
  304 | }
      | ^
./src/cuprstab.c: In function ‘PaStbR’:
./src/cuprstab.c:495:1: error: no return statement in function returning non-void [-Werror=return-type]
  495 | }
./src/cuprstab.c: In function ‘UprStb’:
./src/cuprstab.c:128:1: error: control reaches end of non-void function [-Werror=return-type]
  128 | }
      | ^
./src/cuprstab.c: In function ‘UPrImg’:
./src/cuprstab.c:186:1: error: control reaches end of non-void function [-Werror=return-type]
  186 | }
@dimpase
Copy link
Member

dimpase commented Oct 17, 2022

What C/C++ compiler are you using, on what OS?

@jengelh
Copy link
Author

jengelh commented Oct 17, 2022

$ cat /etc/os-release
NAME="openSUSE Tumbleweed"
# VERSION="20221015"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20221015"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20221015"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"
gcc -v
Using built-in specs.
Reading specs from /usr/lib64/gcc/x86_64-suse-linux/12/defaults.spec
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go,d,jit --enable-offload-targets=nvptx-none,amdgcn-amdhsa, --enable-offload-defaulted --without-cuda-driver --enable-host-shared --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/12 --enable-ssp --disable-libssp --disable-libvtv --enable-cet=auto --disable-libcc1 --enable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-libphobos --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-12 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --with-build-config=bootstrap-lto-lean --enable-link-mutex --build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.1 20220830 [revision e927d1cf141f221c5a32574bde0913307e140984] (SUSE Linux) 

@osj1961
Copy link
Collaborator

osj1961 commented Oct 17, 2022

I notice that the warnings seem to be only related to functions whose entire content is enclosed in #ifdef #endif directives. But they all do seem to return something...

@dimpase
Copy link
Member

dimpase commented Oct 17, 2022

The thing is that #ifdef block contains all the returns. If #ifdef's stuff is not included that the whole function body is just { }, no returns. Hence the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants