Skip to content
  • Tamar Christina's avatar
    Make list of deprecated symbols on Windows weak. · 9968502d
    Tamar Christina authored and Ben Gamari's avatar Ben Gamari committed
    We have a unfortunate workaround in place for the fact that most
    packages out there use POSIX names for symbols even on Windows.  This
    means that we have to recognize e.g. both `_ungetch` and `ungetch`.
    
    The former is the actual symbol name on windows and the latter is the
    POSIX variant. The problem is that on normal windows programs `ungetch`
    should not be in the global namespace.
    
    To work around this, we now mark the deprecated symbols as weak symbols
    in the global namespace. This provides the flexibility we need:
    
    * If you use the symbol without defining it, we assume you meant to use
      the POSIX variant.
    * If you actually define the symbol, we'll hence forth use that
      definition and assume you didn't mean to use POSIX code. This is how
      MingW64's wrapper also works.
    
    This requires D3028.
    
    Fixes #13210.
    
    Test Plan: ./validate
    
    Reviewers: austin, bgamari, erikd, simonmar
    
    Reviewed By: bgamari
    
    Subscribers: thomie, #ghc_windows_task_force
    
    Differential Revision: https://phabricator.haskell.org/D3154
    9968502d