Bug 45131 - EasyHack: remove gcc 2 conditionals ...
Summary: EasyHack: remove gcc 2 conditionals ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Master old -3.6
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2012-01-23 07:38 UTC by Michael Meeks
Modified: 2015-12-15 16:27 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Patch for one such GNUC check (1.13 KB, patch)
2012-02-09 10:24 UTC, Carsten Niehaus
Details

Note You need to log in before you can comment on or make changes to this bug.
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]
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 !
Comment 7 Robinson Tryon (qubit) 2015-12-15 16:27:25 UTC
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup)
[NinjaEdit]