Fixes for modern compilers#80
Open
tvrusso wants to merge 2 commits into
Open
Conversation
Compilers are now fairly strict about function arguments not being declared and being assumed to be int. This patch (taken from PhirePhly#78) fixes that issue.
Modern versions of gcc (starting with version 10) default to "-fno-common", which means that it is necessary to define global variables in ONE file, and in all other files reference that variable only by declaring it with an "extern" keyword. This is not done in aprx, which simply has multiple definitions of a few variables in several different files. In aprx.h, two variables were being defined (aprsis_thread and pthr_attrs). These same variables were then defined again in aprsis.c. aprsis.c is the only file where there is any use of aprsis_thread. Its use of pthr_attrs is only as a temporary in one function. This caused link failure because every file that included aprsx.h had its own copy of those two global variables, even though none of them needed the variables. netresolver.c further has its own definition of a global pthr_attrs that it only uses locally, so the variable is defined twice there (once through aprx.h). Since nobody needs pthr_attrs as a global variable, it should not be in aprx.h and should be locally declared in the functions that use it. Since only aprsis.c needs aprsis_thread and it already defines it itself, it doesn't need it to be in aprx.h. Finally, aprx-stat.c defines "now" as a global variable and so does timercmp.c, causing exactly the same problem at link time. Fortunately, this one's easy because timercmp.c doesn't even *use* that variable, and the simplest thing to do is to remove its definition. Fixes PhirePhly#62 Fixes PhirePhly#72 (which is a duplicate of 62)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are some relics in aprx that depend on behaviors of gcc prior to version 10. This leads to compilation failures with more recent compilers.
The issues are:
This PR allows aprx to compile with compilers as recent as gcc14