This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: w32api compiler warning fix.
- To: cygwin-patches at cygwin dot Com
- Subject: Re: w32api compiler warning fix.
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- Date: Fri, 9 Nov 2001 10:58:56 +1100 (EST)
--- Christopher Faylor <cgf@redhat.com> wrote: > On Fri, Nov 09, 2001 at
07:50:20AM +1100, Danny Smith wrote:
> > --- Earnie Boyd <earnie_boyd@yahoo.com> wrote: > Robert Collins wrote:
> >>
> >> > > -----Original Message-----
> >> > > From: Corinna Vinschen [mailto:cygwin-patches@cygwin.com]
> >> > > > What about this instead?
> >> > >
> >> > > The problem is that the definition doesn't match the MS
> definition.
> >> > > I would prefer to have the headers as close to the MS definitions
> >> > > as possible.
> >> >
> >> > I'm cool either way - Earnie?
> >>
> >> I'm going to defer to Danny. I myself only agree with Corinna's
> argument
> >> in that if it can be found to be documented that way then that's how
> it
> >> should be coded.
> >
> >I think its "just" a preprocessor issue. This is how I would do it (Like
> >the _TEXT macros):
> >
> >#define SECURITY_NULL_SID_AUTHORITY_VALUE {0,0,0,0,0,0}
> >#define SECURITY_WORLD_SID_AUTHORITY_VALUE {0,0,0,0,0,1}
> >#define SECURITY_LOCAL_SID_AUTHORITY_VALUE {0,0,0,0,0,2}
> >#define SECURITY_CREATOR_SID_AUTHORITY_VALUE {0,0,0,0,0,3}
> >#define SECURITY_NON_UNIQUE_AUTHORITY_VALUE {0,0,0,0,0,4}
> >
> >#define SECURITY_NULL_SID_AUTHORITY {SECURITY_NULL_SID_AUTHORITY_VALUE}
> >#define SECURITY_WORLD_SID_AUTHORITY
> {SECURITY_WORLD_SID_AUTHORITY_VALUE}
> >#define SECURITY_LOCAL_SID_AUTHORITY
> {SECURITY_LOCAL_SID_AUTHORITY_VALUE}
> >#define SECURITY_CREATOR_SID_AUTHORITY
> >{SECURITY_CREATOR_SID_AUTHORITY_VALUE}
> >#define SECURITY_NON_UNIQUE_AUTHORITY
> {SECURITY_NON_UNIQUE_AUTHORITY_VALUE}
>
> I believe that still varies from the "one true way" of doing things,
> though.
>
> Is this a gcc vs. msvc issue? I don't understand why the above is
> necessary
> for gcc but not for msvc.
>
> cgf
It's a gcc vs msvc diff in warnings.
Try this:
#include <assert.h>
struct a
{
int b[2];
};
int main (){
struct a gcc_a = {{1,2}};
struct a msvc_a = {3,4};
assert( gcc_a.b[1]= 2);
assert( msvc_a.b[1]= 4);
return 0;
}
The warning about the msvc way appears harmless.
After thinking about last patch it can be generalised to:
#define INIT_SID_AUTHORITY(a) {0,0,0,0,0,a}
#define SECURITY_NULL_SID_AUTHORITY {INIT_SID_AUTHORITY(0)}
#define SECURITY_WORLD_SID_AUTHORITY {INIT_SID_AUTHORITY(1)}
#define SECURITY_LOCAL_SID_AUTHORITY {INIT_SID_AUTHORITY(2)}
#define SECURITY_CREATOR_SID_AUTHORITY {INIT_SID_AUTHORITY(3)}
#define SECURITY_NON_UNIQUE_AUTHORITY {INIT_SID_AUTHORITY(4)}
#define SECURITY_NT_AUTHORITY {INIT_SID_AUTHORITY(5)}
Danny
http://briefcase.yahoo.com.au - Yahoo! Briefcase
- Manage your files online.