Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build failures discovered by an upcoming gcc-14 release #1730

Merged
merged 4 commits into from
Jan 11, 2024

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Dec 6, 2023

Description

Upcoming gcc-14 enabled a few warnings into errors. This exposed build failures related to pointer type confusion.

…cc-14)

Upcoming `gcc-14` enabled a few warnings into errors, like
`-Wint-conversion`. This caused `afdko` build to fail as:

    /build/afdko/c/shared/source/uforead/uforead.c:1243:20: error: passing argument 2 of ‘message’ makes pointer from integer without a cast [-Wint-conversion]
     1243 |         message(h, ufoErrParse, "Encountered glyph reference %s in alternate layer's contents.plist with an empty file path. ", glyphName);
          |                    ^~~~~~~~~~~
          |                    |
          |                    int

It looks like `ufoErrParse` is an unexpected parameter here.

While at it fixed build failure related to int/pointer error:

    /build/afdko/c/shared/source/uforead/uforead.c:2007:16: error: returning ‘void *’ from a function with return type ‘long int’ makes integer from pointer without a cast [-Wint-conversion]
     2007 |         return NULL;
          |                ^~~~
…e (gcc-14)

Upcoming `gcc-14` enabled a few warnings into errors, like
`-Wincompatible-pointer-types`. This caused `afdko` build to fail as:

    /build/afdko/c/shared/source/tx_shared/tx_shared.c: In function ‘stmInit’:
    /build/afdko/c/shared/source/tx_shared/tx_shared.c:526:20: error: assignment to ‘size_t (*)(ctlStreamCallbacks *, void *, char **)’ {aka ‘long unsigned int (*)(struct ctlStreamCallbacks_ *, void *, char **)’} from incompatible pointer type ‘size_t (*)(ctlStreamCallbacks *, Stream *, char **)’ {aka ‘long unsigned int (*)(struct ctlStreamCallbacks_ *, Stream *, char **)’} [-Wincompatible-pointer-types]
      526 |     h->cb.stm.read = stm_read;
          |                    ^

The change fixes opaque parameter to pass as `void *`.
skef
skef previously approved these changes Jan 10, 2024
Copy link
Collaborator

@skef skef left a comment

Choose a reason for hiding this comment

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

lgtm

…rence (gcc-14)

Upcoming `gcc-14` enabled a few warnings into errors, like
`-Wincompatible-pointer-types`. This caused `afdko` build to fail as:

    /build/afdko/c/shared/source/t1write/t1write.c: In function ‘saveCstr’:
    /build/afdko/c/shared/source/t1write/t1write.c:348:28: error: passing argument 3 of ‘writeTmp’ from incompatible pointer type [-Wincompatible-pointer-types]
      348 |         if (writeTmp(h, 1, &info->iFD))
          |                            ^~~~~~~~~~
          |                            |
          |                            uint16_t * {aka short unsigned int *}

The code attempts to use only one byte of 16-bit value. The code very
likely is broken on a big-endian system.

The change explicitly truncates 16-bit value down to 8 bit value to
retain existing behaviour on both BE and LE systems.
Copy link
Collaborator

@skef skef left a comment

Choose a reason for hiding this comment

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

lgtm

@skef skef merged commit 21d8b26 into adobe-type-tools:develop Jan 11, 2024
14 checks passed
@trofi trofi deleted the gcc-14-fix branch January 11, 2024 08:55
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.

None yet

2 participants