Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Confused by com...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 10 Topic 24517 of 27679
Post > Topic >>

Confused by compiler warning

by "James H. Newman" <NewJames@[EMAIL PROTECTED] > Feb 6, 2008 at 12:16 AM

I am playing with some code that has been automatically generated 
from ASN.1 data specification found in RFC 3280. One of the structures 
generated reads as follows:

typedef struct TBSCertList {
        Version_t       *version        /* OPTIONAL */;
        AlgorithmIdentifier_t    signature;
        Name_t   issuer;
        Time_t   thisUpdate;
        struct Time     *nextUpdate     /* OPTIONAL */;
        struct revokedCertificates {
                A_SEQUENCE_OF(struct Member {
                        CertificateSerialNumber_t        userCertificate;
                        Time_t   revocationDate;
                        struct Extensions       *crlEntryExtensions     /
* OPTIONAL */;

                        /* Context for parsing across buffer boundaries */
                        asn_struct_ctx_t _asn_ctx;
                } ) list;

                /* Context for parsing across buffer boundaries */
                asn_struct_ctx_t _asn_ctx;
        } *revokedCertificates;
        struct Extensions       *crlExtensions  /* OPTIONAL */;

        /* Context for parsing across buffer boundaries */
        asn_struct_ctx_t _asn_ctx;
} TBSCertList_t;

/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_TBSCertList;
}

where A_SEQUENCE_OF() is defined as

#define A_SEQUENCE_OF(type)                             \
        struct {                                        \
                type **array;                           \
                int count;      /* Meaningful size */   \
                int size;       /* Allocated size */    \
                void (*free)(type *);                   \
        }

	The preprocessor expands this as

typedef struct TBSCertList {
    Version_t *version;
    AlgorithmIdentifier_t signature;
    Name_t issuer;
    Time_t thisUpdate;
    struct Time *nextUpdate;
    struct revokedCertificates {
        struct {
            struct Member {
                CertificateSerialNumber_t userCertificate;
                Time_t revocationDate;
                struct Extensions *crlEntryExtensions;
                asn_struct_ctx_t _asn_ctx;
            } **array;
            int count;
            int size;
            void (*free) (struct Member {
                          CertificateSerialNumber_t userCertificate;
                          Time_t revocationDate;
                          struct Extensions * crlEntryExtensions;
                          asn_struct_ctx_t _asn_ctx;
                          } *);
        } list;

        asn_struct_ctx_t _asn_ctx;
    } *revokedCertificates;
    struct Extensions *crlExtensions;

    asn_struct_ctx_t _asn_ctx;
} TBSCertList_t;

	This compiles all right, but the GCC compiler generates the 
following warning:

TBSCertList.h:47: warning: structure defined inside parms
TBSCertList.h:47: warning: `struct Member' declared inside parameter list
TBSCertList.h:47: warning: its scope is only this definition or 
declaration, which is probably not what you want

	Line 47 is the line that reads

	} ) list;

in the code above, before the preprocessing.

	Now I want to believe that this code is generated the way it is 
generated for some good reason. What I do not understand is what the 
compiler is complaining about. Anybody care to explain? What is it about 
struct Member that the compiler reckons that that's not what we want?
 




 10 Posts in Topic:
Confused by compiler warning
"James H. Newman&quo  2008-02-06 00:16:59 
Re: Confused by compiler warning
Peter Nilsson <airia@[  2008-02-05 16:38:56 
Re: Confused by compiler warning
Jack Klein <jackklein@  2008-02-05 22:04:36 
Re: Confused by compiler warning
"Stephen Sprunk"  2008-02-07 21:11:45 
Re: Confused by compiler warning
Neil Booth <dev@[EMAIL  2008-02-08 22:17:00 
Re: Confused by compiler warning
Army1987 <army1987@[EM  2008-02-06 11:21:32 
Re: Confused by compiler warning
Keith Thompson <kst-u@  2008-02-06 10:09:29 
Re: Confused by compiler warning
Kenneth Brody <kenbrod  2008-02-06 10:33:43 
Re: Confused by compiler warning
Army1987 <army1987@[EM  2008-02-06 19:58:31 
Re: Confused by compiler warning
=?UTF-8?q?Harald_van_D=C4  2008-02-08 19:59:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 21:17:20 CDT 2008.