[PATCH] D81795: [clang] Enable -mms-bitfields by default for mingw targets

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 13 13:53:52 PDT 2020


mstorsjo created this revision.
mstorsjo added reviewers: rjmccall, rnk.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This matches GCC, which enabled -mms-bitfields by default for mingw targets in 4.7 [1].

[1] https://www.gnu.org/software/gcc/gcc-4.7/changes.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81795

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/ms-bitfields.c


Index: clang/test/Driver/ms-bitfields.c
===================================================================
--- clang/test/Driver/ms-bitfields.c
+++ clang/test/Driver/ms-bitfields.c
@@ -1,4 +1,5 @@
-// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS
+// RUN: %clang -### -target x86_64-linux-gnu %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS
+// RUN: %clang -### -target x86_64-windows-gnu %s 2>&1 | FileCheck %s -check-prefix=MSBITFIELDS
 // RUN: %clang -### -mno-ms-bitfields -mms-bitfields %s 2>&1 | FileCheck %s -check-prefix=MSBITFIELDS
 // RUN: %clang -### -mms-bitfields -mno-ms-bitfields %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS
 
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4646,7 +4646,7 @@
     CmdArgs.push_back("-fforbid-guard-variables");
 
   if (Args.hasFlag(options::OPT_mms_bitfields, options::OPT_mno_ms_bitfields,
-                   false)) {
+                   Triple.isWindowsGNUEnvironment())) {
     CmdArgs.push_back("-mms-bitfields");
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81795.270585.patch
Type: text/x-patch
Size: 1165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200613/841a52ba/attachment.bin>


More information about the cfe-commits mailing list