GithubHelp home page GithubHelp logo

gcc warning with hardening flags about pigz HOT 7 CLOSED

madler avatar madler commented on September 15, 2024
gcc warning with hardening flags

from pigz.

Comments (7)

madler avatar madler commented on September 15, 2024

I put in a (void) to make it explicit that I consciously decided to ignore the return code. That should not generate a warning.

from pigz.

Code7R avatar Code7R commented on September 15, 2024

And it should please also respect the LDFLAGS from environment. Proposal:

diff --git a/Makefile b/Makefile
index 6524ef3..f7f6191 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 CC=cc
 CFLAGS=-O3 -Wall -Wextra
-LDFLAGS=-lz
+LDFLAGS+=-lz
 ZOPFLI=zopfli/src/zopfli/
 # use gcc and gmake on Solaris

from pigz.

Code7R avatar Code7R commented on September 15, 2024

Sorry, (void) doesn't help here. I had to find a workaround in one of my projects for this check. Quote:


// STFU helpers, (void) casts are not effective for certain functions
static inline void ignore_value (int i) { (void) i; }
static inline void ignore_ptr (void* p) { (void) p; }

from pigz.

madler avatar madler commented on September 15, 2024

You only got a warning for chown?

from pigz.

madler avatar madler commented on September 15, 2024

Your suggestion for += in the Makefile is a different issue. You should create a new issue for that, and not mix it up with voided return codes.

from pigz.

Code7R avatar Code7R commented on September 15, 2024

Yes, only this one. For example, see https://buildd.debian.org/status/fetch.php?pkg=pigz&arch=i386&ver=2.3.3-1&stamp=1422210364 .

Regarding += issue, that one is partially related, at least from my perspective. This style of value assignment (and gmake's lazy initialization rules) prevented the hardening flags from being passed. I used a workaround in the meantime (pushing CPPFLAGS/LDFLAGS/etc. from the make command line) and it's OK, so no new item related to that for now.

from pigz.

madler avatar madler commented on September 15, 2024

Then it's a bug in the compiler. The behavior should be consistent with all of the other occurrences of voided return values, such as the chmod() and utimes() in the same routine, and the other dozen or more times int return values are voided in pigz.c. Either all of them should get the warning, or none of them should.

from pigz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.