Skip to content

Better gcc compiler version check. Previous check failed for gcc-10 - #253

Merged
atupone merged 1 commit into
BZFlag-Dev:2.4from
atupone:gcc-10
May 19, 2020
Merged

atupone merged 1 commit into
BZFlag-Dev:2.4from
atupone:gcc-10

Conversation

@atupone

@atupone atupone commented May 15, 2020

Copy link
Copy Markdown
Contributor

No description provided.

@atupone
atupone requested review from blast007, jwmelto and macsforme May 15, 2020 07:22

@jwmelto jwmelto left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please describe the motivation for this change?

A couple of comments about your approach:

  • the $(...) syntax is specific to bash or zsh (maybe ksh, I forget). Specifically, it is not supported by sh. This is confused by the fact that sh may actually be a link to a newer shell on some systems. Unless this is explicitly a bash script, this change may not work on some platforms.
  • regexes are powerful but hard to grok. It’s clear from your expected values what you think it should do but less clear how or that it does it. What value does this change provide over what is there? Why is it better?
  • gcc has adopted the modern philosophy of rapidly increasing major numbers. I think 10 may be available. How will this logic support 2-digit major versions?
  • what I expected was a numerical comparison rather than a lexical one. That seems more robust and easier to comprehend. Did you consider that, and if so, what were your reasons for rejecting it?

@atupone

atupone commented May 16, 2020

Copy link
Copy Markdown
Contributor Author

Can you please describe the motivation for this change?
Previous check was "10.1.0" >= "4.3" and it did not succeed.
the only comparison could be made as string as 10.1.0 is not a number
the change is to make each version pieces as a 2 digit number and concatenate all
so 10.1.0 become 100100
and 8.3.1 become 080101
and also 4.3 to become 040300

I understand that some older gcc version gave us only two version pieces: major.minor

Comment thread configure.ac Outdated
# if minor or patch are 1 digits remove the '.' and add a 0
# if there is no patch part, so the resulting version is 3 or 4 digits only add 00 ath the end
# This is to change 4.7.1 in 040701 or 3.4 in 030400
GCCVER=`$CC -dumpversion | sed -e 's|\.\([[0-9]][[0-9]]\)|\1|g' -e 's|\.\([[0-9]]\)|0\1|g' -e 's|^[[0-9]]\{3,4\}$|&00|'`

@jwmelto jwmelto May 16, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work for MacOS 10.13 (should it? does it need to?

Goliath:~ jwmelto$ gcc -dumpversion | sed -e 's|\.\([[0-9]][[0-9]]\)|\1|g' -e 's|\.\([[0-9]]\)|0\1|g' -e 's|^[[0-9]]\{3,4\}$|&00|'
4.2.1
Suggested change
GCCVER=`$CC -dumpversion | sed -e 's|\.\([[0-9]][[0-9]]\)|\1|g' -e 's|\.\([[0-9]]\)|0\1|g' -e 's|^[[0-9]]\{3,4\}$|&00|'`
GCCVER=`$CC -dumpversion | awk -F. '{printf "%02d%02d%02d", $1,$2,$3}'`

or use ax_compare_version as @blast007 suggested

@jwmelto

jwmelto commented May 19, 2020

Copy link
Copy Markdown
Member

That looks familiar. Good change.

@jwmelto

jwmelto commented May 19, 2020

Copy link
Copy Markdown
Member

Now I know why this looks familiar. See #236

@atupone
atupone merged commit 974ebed into BZFlag-Dev:2.4 May 19, 2020
@atupone
atupone deleted the gcc-10 branch May 21, 2020 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants