Announcement

Collapse
No announcement yet.

Torvalds Has It With "-Wstringop-overflow" On GCC Due To Kernel Breakage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Originally posted by oleid View Post
    We had a strict "no warning" in the mainline branch policy at my last employer. But typically Werror was not enabled globally since using different compilers resulted in different warnings. And the no warning policy makes lots of sense since existing warnings mask new warnings that pop up during development easily.
    Yeah that's fine. We sometimes disable bogus warnings though, because we can't just wait for upstream compiler to fix it, it takes forever sometimes.

    Comment


    • #22
      This is exactly what I meant when I said (in another thread) that Torvalds did a tremendous disservice to linux with his rant about C++. With C++ this would not be an issue today.

      ... and it would be quiet in the camp of the rustafarians.

      Comment


      • #23
        Originally posted by lowflyer View Post
        This is exactly what I meant when I said (in another thread) that Torvalds did a tremendous disservice to linux with his rant about C++. With C++ this would not be an issue today.
        Yes, with things like constructors and operator overloading, you can make nice string classes in C++ ...even ones appropriate for in-kernel use.

        However, let's not pretend that C++ is a panacea to compiler false-positives. For instance, GCC has long had issues figuring out that a std:: optional's value isn't being used without initialization. So, on the specific topic of compiler warnings with false positives, using C++ would quite likely open the door to even more of these.

        That's not meant as an argument one way or another, but just a reality check.

        Comment


        • #24
          Originally posted by coder View Post
          ../. So, on the specific topic of compiler warnings with false positives, using C++ would quite likely open the door to even more of these.

          That's not meant as an argument one way or another, but just a reality check.
          It's easy to say "it's a false positive, we ought to ignore these". "False" positives show up in code sections that are questionable at least. Irrespective of the language used. (The compiler understands it, but does anybody else?)

          Turning this warning off globally shows an unfortunate ignorance of the linux kernel team. It is another way of saying "we want to continue creating our questionable constructions and we don't care about better ones".

          Comment


          • #25
            Originally posted by coder View Post
            Yes, with things like constructors and operator overloading, you can make nice string classes in C++ ...even ones appropriate for in-kernel use.

            However, let's not pretend that C++ is a panacea to compiler false-positives. For instance, GCC has long had issues figuring out that a std:: optional's value isn't being used without initialization. So, on the specific topic of compiler warnings with false positives, using C++ would quite likely open the door to even more of these.

            That's not meant as an argument one way or another, but just a reality check.
            you are comparing a language flaw to a compiler flaw which is not a fair comparison. For example for a very long time MSVC didnt know how to parse templates where a >> occured in it, in the old days, the fix was putting a space between it!. Which has nothing to do with flaws in the C++ language. The flaw with C is that is no scope management which leads to all kind of memory management bugs/exploits. I mean even in C they could implement some string infrastructure instead of relying on a pointer and zero termination.
            Last edited by cj.wijtmans; 04 February 2024, 06:29 PM.

            Comment


            • #26
              Originally posted by lowflyer View Post
              Turning this warning off globally shows an unfortunate ignorance of the linux kernel team.
              So, Torvalds is ignorant of the compiler issues?
              Speaking of ignorant, this feature wasn't on in the past, and they were trying to enable it when they got totally inconsistent results.

              Comment


              • #27
                Originally posted by NateHubbard View Post

                So, Torvalds is ignorant of the compiler issues?
                Speaking of ignorant, this feature wasn't on in the past, and they were trying to enable it when they got totally inconsistent results.
                Yes, Torvalds is ignorant. But not of the compiler issues; of the issues within the kernel. You got that wrong.

                Comment

                Working...
                X