The "-mms-bitfields" commandline parameter now properly turns on the ms_struct 
behavior.

I've never submitted a code change before, hopefully I did this correctly. I 
included the patch and a new test file.

One result of this change is that __attribute__((ms_struct)) on an enum will 
produce a warning, for example:

enum __attribute__((ms_struct)) bar {
        BAR_A = 0,
        BAR_B,
        BAR_C
};

ms-bitfields-test.cpp:4:21: warning: 'ms_struct' attribute ignored
enum __attribute__((ms_struct)) bar {

Is this desired?

Jeremiah

________________________________

This message, including any attachments, may contain privileged and/or 
confidential information. Any distribution or use of this email by anyone other 
than the intended recipient(s) is strictly prohibited. If you are not the 
intended recipient, please notify the sender immediately and delete all copies. 
Thank you.

Attachment: mms-bitfields.patch
Description: mms-bitfields.patch

// RUN: %clang_cc1 -D TEST=1 -mms-bitfields -emit-llvm-only -triple 
i386-apple-darwin10 %s
// RUN: %clang_cc1 -D TEST=2 -emit-llvm-only -triple i386-apple-darwin10 %s
// RUN: %clang_cc1 -D TEST=3 -emit-llvm-only -triple i386-apple-darwin10 %s

#if (TEST == 2)
   // -mms-bitfields should behave the same as __attribute__((ms_struct))
   #define MS_STRUCT __attribute__((ms_struct))
#else
   #define MS_STRUCT
#endif

struct
{
   int a : 1;
   short b : 1;
} MS_STRUCT t1;

#if (TEST == 1) || (TEST == 2)
   // MS pads out bitfields between different types.
   static int arr1[(sizeof(t1) == 8) -1];
#else
   // Not using MS bitfields.
   static int arr1[(sizeof(t1) == 4) -1];
#endif

int main() {
  return 0;
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to