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

Warnings about Ignored Return Values #1579

Open
sanssecours opened this Issue Aug 18, 2017 · 7 comments

Comments

Projects
None yet
5 participants
@sanssecours
Contributor

sanssecours commented Aug 18, 2017

Steps to Reproduce

  1. Clone the repository
  2. Build Elektra in Ubuntu 14.04 using the steps provided in .travis.yml

Expected Result

Elektra builds without any warnings

Actual Result

The Travis build reports the following warnings:

src/plugins/crypto/gpg.c: In function ‘libelektra_ELEKTRA_PLUGIN_NAME_C_LTX_elektraPlugingpgCall’:
src/plugins/crypto/gpg.c:787:8: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
    dup (pipe_stdin[0]);
        ^
src/plugins/crypto/gpg.c:793:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stdout[1]);
       ^
src/plugins/crypto/gpg.c:798:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stderr[1]);
       ^
src/plugins/crypto/gpg.c:818:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write (pipe_stdin[1], keyValue (msgKey), keyGetValueSize (msgKey));
         ^
[27/777] Building C object src/plugins...ktra-crypto_gcrypt-objects.dir/gpg.c.o
src/plugins/crypto/gpg.c: In function ‘libelektra_crypto_gcrypt_LTX_elektraPlugingpgCall’:
src/plugins/crypto/gpg.c:787:8: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
    dup (pipe_stdin[0]);
        ^
src/plugins/crypto/gpg.c:793:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stdout[1]);
       ^
src/plugins/crypto/gpg.c:798:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stderr[1]);
       ^
src/plugins/crypto/gpg.c:818:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write (pipe_stdin[1], keyValue (msgKey), keyGetValueSize (msgKey));
         ^
[33/777] Building C object src/plugins...tra-crypto_openssl-objects.dir/gpg.c.o
src/plugins/crypto/gpg.c: In function ‘libelektra_crypto_openssl_LTX_elektraPlugingpgCall’:
src/plugins/crypto/gpg.c:787:8: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
    dup (pipe_stdin[0]);
        ^
src/plugins/crypto/gpg.c:793:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stdout[1]);
       ^
src/plugins/crypto/gpg.c:798:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stderr[1]);
       ^
src/plugins/crypto/gpg.c:818:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write (pipe_stdin[1], keyValue (msgKey), keyGetValueSize (msgKey));
         ^
[34/777] Building C object src/plugins...-csvstorage-objects.dir/csvstorage.c.o
src/plugins/csvstorage/csvstorage.c: In function ‘readNextLine’:
src/plugins/csvstorage/csvstorage.c:250:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
   fgets (buffer, len, fp);
         ^
[39/777] Building C object src/plugins...lektra-curlget-objects.dir/curlget.c.o
src/plugins/curlget/curlget.c: In function ‘elektraCurlgetGet’:
src/plugins/curlget/curlget.c:643:8: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread (&buffer, sizeof (char), size, fp);
        ^
src/plugins/curlget/curlget.c: In function ‘elektraCurlgetSet’:
src/plugins/curlget/curlget.c:713:10: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
    fread (&buffer, sizeof (char), size, fp);
          ^
[43/777] Building C object src/plugins.../elektra-fcrypt-objects.dir/fcrypt.c.o
src/plugins/fcrypt/fcrypt.c: In function ‘shredTemporaryFile’:
src/plugins/fcrypt/fcrypt.c:92:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write (fd, buffer, sizeof (buffer));
         ^
[61/777] Building C object src/plugins...ineendings-objects.dir/lineendings.c.o
src/plugins/lineendings/lineendings.c: In function ‘checkLineEndings’:
src/plugins/lineendings/lineendings.c:55:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  (void)fread (&fc, 1, 1, fp);
  ^
src/plugins/lineendings/lineendings.c:58:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
   (void)fread (&sc, 1, 1, fp);
   ^
src/plugins/lineendings/lineendings.c:80:4: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
    (void)fread (&sc, 1, 1, fp);
    ^
[86/777] Building C object src/plugins...solver_fm_b_b-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[88/777] Building C object src/plugins...olver_fm_hb_b-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[89/777] Building C object src/plugins...olver_fm_hp_b-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[92/777] Building C object src/plugins...lver_fm_hpu_b-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[94/777] Building C object src/plugins...olver_fm_pb_b-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[95/777] Building C object src/plugins...olver_fm_ub_x-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[98/777] Building C object src/plugins...ver_fm_uhb_xb-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[99/777] Building C object src/plugins...olver_fm_xb_x-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[102/777] Building C object src/plugin...lver_fm_xhp_x-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[105/777] Building C object src/plugin...olver_fm_xp_x-objects.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[204/777] Building C object src/plugin...iles/elektra-crypto_gcrypt.dir/gpg.c.o
src/plugins/crypto/gpg.c: In function ‘libelektra_crypto_gcrypt_LTX_elektraPlugingpgCall’:
src/plugins/crypto/gpg.c:787:8: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
    dup (pipe_stdin[0]);
        ^
src/plugins/crypto/gpg.c:793:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stdout[1]);
       ^
src/plugins/crypto/gpg.c:798:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stderr[1]);
       ^
src/plugins/crypto/gpg.c:818:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write (pipe_stdin[1], keyValue (msgKey), keyGetValueSize (msgKey));
         ^
[209/777] Building C object src/plugin...les/elektra-crypto_openssl.dir/gpg.c.o
src/plugins/crypto/gpg.c: In function ‘libelektra_crypto_openssl_LTX_elektraPlugingpgCall’:
src/plugins/crypto/gpg.c:787:8: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
    dup (pipe_stdin[0]);
        ^
src/plugins/crypto/gpg.c:793:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stdout[1]);
       ^
src/plugins/crypto/gpg.c:798:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stderr[1]);
       ^
src/plugins/crypto/gpg.c:818:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write (pipe_stdin[1], keyValue (msgKey), keyGetValueSize (msgKey));
         ^
[211/777] Building C object src/plugin.../elektra-csvstorage.dir/csvstorage.c.o
src/plugins/csvstorage/csvstorage.c: In function ‘readNextLine’:
src/plugins/csvstorage/csvstorage.c:250:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
   fgets (buffer, len, fp);
         ^
[220/777] Building C object src/plugin...s/elektra-fcrypt.dir/__/crypto/gpg.c.o
src/plugins/crypto/gpg.c: In function ‘libelektra_ELEKTRA_PLUGIN_NAME_C_LTX_elektraPlugingpgCall’:
src/plugins/crypto/gpg.c:787:8: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
    dup (pipe_stdin[0]);
        ^
src/plugins/crypto/gpg.c:793:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stdout[1]);
       ^
src/plugins/crypto/gpg.c:798:7: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
   dup (pipe_stderr[1]);
       ^
src/plugins/crypto/gpg.c:818:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write (pipe_stdin[1], keyValue (msgKey), keyGetValueSize (msgKey));
         ^
[223/777] Building C object src/plugin...akeFiles/elektra-fcrypt.dir/fcrypt.c.o
src/plugins/fcrypt/fcrypt.c: In function ‘shredTemporaryFile’:
src/plugins/fcrypt/fcrypt.c:92:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write (fd, buffer, sizeof (buffer));
         ^
[241/777] Building C object src/plugin...lektra-lineendings.dir/lineendings.c.o
src/plugins/lineendings/lineendings.c: In function ‘checkLineEndings’:
src/plugins/lineendings/lineendings.c:55:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  (void)fread (&fc, 1, 1, fp);
  ^
src/plugins/lineendings/lineendings.c:58:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
   (void)fread (&sc, 1, 1, fp);
   ^
src/plugins/lineendings/lineendings.c:80:4: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
    (void)fread (&sc, 1, 1, fp);
    ^
[277/777] Building C object src/plugin...ektra-resolver_fm_b_b.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[280/777] Building C object src/plugin...ktra-resolver_fm_hb_b.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[283/777] Building C object src/plugin...ktra-resolver_fm_hp_b.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[286/777] Building C object src/plugin...tra-resolver_fm_hpu_b.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[289/777] Building C object src/plugin...ktra-resolver_fm_pb_b.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[292/777] Building C object src/plugin...ktra-resolver_fm_xb_x.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[293/777] Building C object src/plugin...ktra-resolver_fm_ub_x.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[296/777] Building C object src/plugin...ra-resolver_fm_uhb_xb.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[301/777] Building C object src/plugin...tra-resolver_fm_xhp_x.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[303/777] Building C object src/plugin...ktra-resolver_fm_xp_x.dir/resolver.c.o
src/plugins/resolver/resolver.c: In function ‘elektraSetCommit’:
src/plugins/resolver/resolver.c:984:10: warning: ignoring return value of ‘fchown’, declared with attribute warn_unused_result [-Wunused-result]
   fchown (fd, pk->uid, pk->gid);
          ^
[375/777] Building C object src/plugin...eFiles/elektra-curlget.dir/curlget.c.o
src/plugins/curlget/curlget.c: In function ‘elektraCurlgetGet’:
src/plugins/curlget/curlget.c:643:8: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  fread (&buffer, sizeof (char), size, fp);
        ^
src/plugins/curlget/curlget.c: In function ‘elektraCurlgetSet’:
src/plugins/curlget/curlget.c:713:10: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
    fread (&buffer, sizeof (char), size, fp);
          ^
[517/777] Building C object src/bindin.../elektraintercept-fs.dir/intercept.c.o
src/bindings/intercept/fs/intercept.c: In function ‘resolvePathname’:
src/bindings/intercept/fs/intercept.c:219:10: warning: ignoring return value of ‘getcwd’, declared with attribute warn_unused_result [-Wunused-result]
   getcwd (cwd, PATH_MAX);
          ^
src/bindings/intercept/fs/intercept.c: In function ‘init’:
src/bindings/intercept/fs/intercept.c:115:9: warning: ignoring return value of ‘getcwd’, declared with attribute warn_unused_result [-Wunused-result]
  getcwd (cwd, PATH_MAX);
         ^
[524/777] Building CXX object src/bind...mark_getenv.dir/benchmark_getenv.cpp.o
src/bindings/intercept/env/benchmarks/benchmark_getenv.cpp: In function ‘void benchmark_getenv()’:
src/bindings/intercept/env/benchmarks/benchmark_getenv.cpp:67:19: warning: ignoring return value of ‘char* getenv(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
   getenv ("HELLO");
                   ^
[592/777] Building C object examples/CMakeFiles/kdbset.dir/kdbset.c.o
examples/kdbset.c: In function ‘showElektraErrorDialog’:
examples/kdbset.c:19:8: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf ("%d", &a);
        ^
[617/777] Building C object examples/CMakeFiles/namespace.dir/namespace.c.o
examples/namespace.c: In function ‘main’:
examples/namespace.c:64:8: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
  fgets (s, 100, stdin);
        ^
[632/777] Building C object src/plugin...ta.dir/keytometa/testmod_keytometa.c.o
src/plugins/keytometa/testmod_keytometa.c: In function ‘createMergingKey’:
src/plugins/keytometa/testmod_keytometa.c:34:11: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
  asprintf (&name, "user/convertkey%d", i);
           ^
src/plugins/keytometa/testmod_keytometa.c:35:11: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
  asprintf (&value, "meta line %d", i);
           ^
src/plugins/keytometa/testmod_keytometa.c:36:11: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]

System Information

  • Elektra Version: master
  • OS: Ubuntu 14.04
@petermax2

This comment has been minimized.

Show comment
Hide comment
@petermax2

petermax2 Aug 18, 2017

Member

@sanssecours thank you for reporting! I will have a look at all crypto-related (and fcrypt-related) warnings.

Member

petermax2 commented Aug 18, 2017

@sanssecours thank you for reporting! I will have a look at all crypto-related (and fcrypt-related) warnings.

@markus2330

This comment has been minimized.

Show comment
Hide comment
@markus2330

markus2330 Aug 18, 2017

Contributor

@sanssecours Thank you for the report!

@petermax2 Thanks for doing your part!

I wonder why I do not see the warnings locally. Compiler seems to be 4.8.4, and flags are:

-- C flags are  -std=gnu99  -Wno-deprecated-declarations  -Wstrict-prototypes  -Wno-long-long -pedantic -Wno-variadic-macros -Wall -Wextra -Wno-overlength-strings -Wsign-compare -Wfloat-equal -Wformat-security -Wshadow -Wcomments -Wtrigraphs -Wundef -Wuninitialized -Winit-self -Wmaybe-uninitialized -Wsign-compare -Wfloat-equal -Wformat-security
-- CXX flags are  -std=c++11  -Wno-deprecated-declarations  -Wold-style-cast -Wstrict-null-sentinel -D_GLIBCXX_USE_NANOSLEEP -Wno-missing-field-initializers -Woverloaded-virtual  -Wsign-promo  -Wno-long-long -pedantic -Wno-variadic-macros -Wall -Wextra -Wno-overlength-strings -Wsign-compare -Wfloat-equal -Wformat-security -Wshadow -Wcomments -Wtrigraphs -Wundef -Wuninitialized -Winit-self -Wmaybe-uninitialized

The flags are identical to my system, except it has an additional -Wall at beginning. (Also tried to that locally, does not seem to make a difference.) Does Ubuntu have additional attribute declarations in their header files?

In some of the warnings there is already a (void), which is usually the way to suppress these warnings.

Contributor

markus2330 commented Aug 18, 2017

@sanssecours Thank you for the report!

@petermax2 Thanks for doing your part!

I wonder why I do not see the warnings locally. Compiler seems to be 4.8.4, and flags are:

-- C flags are  -std=gnu99  -Wno-deprecated-declarations  -Wstrict-prototypes  -Wno-long-long -pedantic -Wno-variadic-macros -Wall -Wextra -Wno-overlength-strings -Wsign-compare -Wfloat-equal -Wformat-security -Wshadow -Wcomments -Wtrigraphs -Wundef -Wuninitialized -Winit-self -Wmaybe-uninitialized -Wsign-compare -Wfloat-equal -Wformat-security
-- CXX flags are  -std=c++11  -Wno-deprecated-declarations  -Wold-style-cast -Wstrict-null-sentinel -D_GLIBCXX_USE_NANOSLEEP -Wno-missing-field-initializers -Woverloaded-virtual  -Wsign-promo  -Wno-long-long -pedantic -Wno-variadic-macros -Wall -Wextra -Wno-overlength-strings -Wsign-compare -Wfloat-equal -Wformat-security -Wshadow -Wcomments -Wtrigraphs -Wundef -Wuninitialized -Winit-self -Wmaybe-uninitialized

The flags are identical to my system, except it has an additional -Wall at beginning. (Also tried to that locally, does not seem to make a difference.) Does Ubuntu have additional attribute declarations in their header files?

In some of the warnings there is already a (void), which is usually the way to suppress these warnings.

@sanssecours

This comment has been minimized.

Show comment
Hide comment
@sanssecours

sanssecours Aug 18, 2017

Contributor

Does Ubuntu have additional attribute declarations in their header files?

I would assume so. Seems like the definitions for the functions above use the function attribute warn_unused_result:

The warn_unused_result attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug, such as realloc.

.

In some of the warnings there is already a (void), which is usually the way to suppress these warnings.

I do not think this will work here, since the function annotations specifically state that we should not ignore the return value.

Contributor

sanssecours commented Aug 18, 2017

Does Ubuntu have additional attribute declarations in their header files?

I would assume so. Seems like the definitions for the functions above use the function attribute warn_unused_result:

The warn_unused_result attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug, such as realloc.

.

In some of the warnings there is already a (void), which is usually the way to suppress these warnings.

I do not think this will work here, since the function annotations specifically state that we should not ignore the return value.

@sanssecours sanssecours referenced this issue Aug 19, 2017

Merged

Travis: Add Basic Linux Build #1580

2 of 2 tasks complete
@markus2330

This comment has been minimized.

Show comment
Hide comment
@markus2330

markus2330 Aug 19, 2017

Contributor

When compiling a Debian package (e.g. with the script scripts/build-debian-package added in 1a8aaae) you also get some unused-result warnings in Debian.

Adding

set (COMMON_FLAGS "${COMMON_FLAGS} -Wunused-result")

in cmake/ElektraCompiling.cmake does not have an effect, it is already default.

Contributor

markus2330 commented Aug 19, 2017

When compiling a Debian package (e.g. with the script scripts/build-debian-package added in 1a8aaae) you also get some unused-result warnings in Debian.

Adding

set (COMMON_FLAGS "${COMMON_FLAGS} -Wunused-result")

in cmake/ElektraCompiling.cmake does not have an effect, it is already default.

petermax2 added a commit to petermax2/libelektra that referenced this issue Aug 26, 2017

crypto: fix compiler warning in crypto_botan
Fix unused return value of a read call.

Related to but not mentioned in #1579 .

petermax2 added a commit to petermax2/libelektra that referenced this issue Aug 26, 2017

fcrypt: fix compiler warning
Handle unused return value of write ().
Related to #1579 .

petermax2 added a commit to petermax2/libelektra that referenced this issue Aug 26, 2017

crypto: fix compiler warnings in gpg
Handle unused return values of calls to dup() and write().
Related to #1579 .
@petermax2

This comment has been minimized.

Show comment
Hide comment
@petermax2

petermax2 Aug 26, 2017

Member

I could not reproduce any of the warnings above locally but found another unused return value with clang -Wunused-result in botan_operations.cpp that has not been mentioned above.

It would be interesting to know how to consistently reproduce these warnings.

Member

petermax2 commented Aug 26, 2017

I could not reproduce any of the warnings above locally but found another unused return value with clang -Wunused-result in botan_operations.cpp that has not been mentioned above.

It would be interesting to know how to consistently reproduce these warnings.

@petermax2 petermax2 referenced this issue Aug 26, 2017

Merged

Fix compiler warnings (#1579 ) #1589

2 of 6 tasks complete
@markus2330

This comment has been minimized.

Show comment
Hide comment
@markus2330

markus2330 Aug 26, 2017

Contributor

It would be interesting to know how to consistently reproduce these warnings.

Yes. Seems like we are tied to either use the specific distributions+compilers or look at the output from the build servers.

Contributor

markus2330 commented Aug 26, 2017

It would be interesting to know how to consistently reproduce these warnings.

Yes. Seems like we are tied to either use the specific distributions+compilers or look at the output from the build servers.

markus2330 added a commit that referenced this issue Aug 30, 2017

@petermax2 petermax2 removed their assignment Sep 2, 2017

BernhardDenner added a commit to BernhardDenner/libelektra that referenced this issue Oct 14, 2017

crypto: fix compiler warning in crypto_botan
Fix unused return value of a read call.

Related to but not mentioned in #1579 .

BernhardDenner added a commit to BernhardDenner/libelektra that referenced this issue Oct 14, 2017

fcrypt: fix compiler warning
Handle unused return value of write ().
Related to #1579 .

BernhardDenner added a commit to BernhardDenner/libelektra that referenced this issue Oct 14, 2017

crypto: fix compiler warnings in gpg
Handle unused return values of calls to dup() and write().
Related to #1579 .
@markus2330

This comment has been minimized.

Show comment
Hide comment
@markus2330

markus2330 Oct 29, 2017

Contributor

We need to separate unimportant (benchmarks, test cases, I opened #1664 for them) and important (forgotten) unhandled return values. I 'll fix some of the important ones.

Contributor

markus2330 commented Oct 29, 2017

We need to separate unimportant (benchmarks, test cases, I opened #1664 for them) and important (forgotten) unhandled return values. I 'll fix some of the important ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment