Bug 45131

Summary: EasyHack: remove gcc 2 conditionals ...
Product: LibreOffice Reporter: Michael Meeks <michael.meeks>
Component: LibreofficeAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: sbergman
Version: Master old -3.6   
Hardware: Other   
OS: All   
Whiteboard: EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup
i915 platform: i915 features:
Attachments: Patch for one such GNUC check

Description Michael Meeks 2012-01-23 07:38:56 UTC
The code-base still has a number of conditionals around the place to handle really really old gcc versions that we no longer compile with.

#if defined(__GNUC__) && (__GNUC__ < 3)
    struct ::stat a_stat, b_stat;
#else
    struct stat a_stat, b_stat;
#endif

This clutters and uglifies the code - often the code changes were added to workaround a specific gcc2 bug, not present in more recent and compliant gcc's.

We should search the code-base for __GNUC__ version checks and kill everything that is for less than 3.

Thanks :-)
Comment 1 Thomas Collerton 2012-02-06 08:48:34 UTC
Just a question: what's the minimal version of gcc required?
Comment 2 Michael Meeks 2012-02-08 06:06:40 UTC
Actually it's better than this - the oldest gcc we need to support is 4.0.1 - which is used on Macs I think; so - I suspect that even more of the conditionals can go on that basis :-)
Comment 3 Carsten Niehaus 2012-02-09 10:24:25 UTC
Created attachment 56827 [details] [review]
Patch for one such GNUC check
Comment 4 Carsten Niehaus 2012-02-09 10:27:12 UTC
This was my first patch to LO... I wonder which files I have to check. I just grepped like this:

   find . -name *.cxx | xargs grep __GNU__



and fixed the first low hanging fruit I found. Was this correct?
Comment 5 Stephan Bergmann 2012-02-10 02:03:48 UTC
Carsten, patch looks good.  Pushed, thanks.  Please add yourself to <http://wiki.documentfoundation.org/Development/Developers>, including a statement under what license your patches are -- preferably the LGPLv3+/MPL1.1+ combo.

The easiest way to find relevant parts of the code would probably be just

  git grep -Flw __GNUC__

to get a list of all files that mention it.
Comment 6 Michael Meeks 2012-02-13 09:41:45 UTC
Alexander Bergmann just nailed a number more of these; leaving only a few in sal/ left that are more interesting and Stephan can perhaps comment on on the mailing list (?) so I'll mark this closed: thanks guys !

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.