Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • I Icecast-common
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Xiph.OrgXiph.Org
  • Icecast-common
  • Merge requests
  • !2

Fix an implicit declaration of gettimeofday when building for mingw

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Martin Storsjö requested to merge mstorsjo/icecast-common:win32-gettimeofday into master Apr 22, 2022
  • Overview 0
  • Commits 1
  • Changes 1

When building for a mingw target, HAVE_GETTIMEOFDAY is defined (as the gettimeofday function was found), but the #ifdef _WIN32 #else block never tried to include <sys/time.h> (which provides the declaration) and/or <time.h> for such targets. This caused gettimeofday to be used without a prior declaration.

This has been visible as an easily overlooked warning, but Clang 15 changed this into a fatal error by default, when building in C99 mode (or newer). [1] (While Clang 15 still is under development, this may still change before it's released, but the warning is valid in any case.)

Decouple including of those headers from the #ifdef _WIN32 #else block and just check their corresponding availability defines.

[1] https://github.com/llvm/llvm-project/commit/7d644e1215b376ec5e915df9ea2eeb56e2d94626

This fixes issue #8.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: win32-gettimeofday