Fix build with link-time optimization #26
Merged
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.
When building with link-time optimization enabled, the compiler errors out due to some arrays being declared with different sizes in different compilation units. All of the problematic declarations are of character arrays of size
MAXPATHLEN
inxv.h
, which is included by all of xv's source files.However, the value of the token
MAXPATHLEN
varies depending on whether or not the tokenNEEDSDIR
is defined at the time of xv.h's inclusion. If it is defined,MAXPATHLEN
will be defined via system headers, typically to a value of 4096. If it is not defined, a default value of 256 is used. TheNEEDSDIR
mechanism was probably created to speed up compilation by not including files unnecessarily on the very old and slow systems that xv was originally written for, and is almost certainly unnecessary now. Hence, the fix for this issue is to get rid ofNEEDSDIR
altogether and just include the necessary files unconditionally.Fixes #25.