[flang] Added windows-include.h wrapper to resolve name conflicts. (#87650)
The header file includes windows.h in a mean-and-lean way to avoid bringing in names that may conflict with Flang code.
This commit is contained in:
parent
f5960c168d
commit
864d2531df
25
flang/include/flang/Common/windows-include.h
Normal file
25
flang/include/flang/Common/windows-include.h
Normal file
@ -0,0 +1,25 @@
|
||||
//===-- include/flang/Common/windows-include.h ------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Wrapper around windows.h that works around the name conflicts.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef FORTRAN_COMMON_WINDOWS_INCLUDE_H_
|
||||
#define FORTRAN_COMMON_WINDOWS_INCLUDE_H_
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#endif // FORTRAN_COMMON_WINDOWS_INCLUDE_H_
|
@ -16,9 +16,7 @@
|
||||
#include <limits>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#include "flang/Common/windows-include.h"
|
||||
|
||||
// On Windows GetCurrentProcessId returns a DWORD aka uint32_t
|
||||
#include <processthreadsapi.h>
|
||||
|
@ -16,9 +16,7 @@
|
||||
#include <future>
|
||||
#include <limits>
|
||||
#ifdef _WIN32
|
||||
#define LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#include "flang/Common/windows-include.h"
|
||||
#else
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
|
@ -17,9 +17,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#include "flang/Common/windows-include.h"
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -25,9 +25,7 @@
|
||||
#if USE_PTHREADS
|
||||
#include <pthread.h>
|
||||
#elif defined(_WIN32)
|
||||
// Do not define macros for "min" and "max"
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#include "flang/Common/windows-include.h"
|
||||
#else
|
||||
#include <mutex>
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user