-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If ASN_THREAD_SAFE and EMIT_ASN_DEBUG is set, per_opentype.c does not compile #15
Comments
Please pull up and try again. |
Tested again with vlm-asn1c-b4c2ca8.tar.gz and with CFLAGS += -DEMIT_ASN_DEBUG=1 -D_REENTRANT. I still get the same errors. Actually I do not see any changes in the sources wrt. the described issue. |
Oops, forgot to push. Now, try. |
Thanks, now I see the changes. I compiled four different cases; one is successful, one with compiler error and two with warning and linker error (see below). The easiest issue is case 3, this is just a typo, probably 'increment' has to be replaced with 'i'. Case 1 and 2 (EMIT_ASN_DEBUG != 1) does not define the ASN_DEBUG_INDENT_ADD macro, but I don't know what exactly has to be defined here. Actually I even do not understand your while(false) loop. Case 4 with threading and ASN debug compiles and links fine. Using vlm-asn1c-69c73dc.tar.gz. Case 1: Case 2: Case 3: Case 4: |
Fixed, try again! |
Case 1, 2 and 4 can be compiled now. At lease for me, case 3 results in a linker error:
Linker error:
As far as I see, the issue is, that I compile asn.o with gcc but client.c with g++ (just wondering, why extern "C" does not help). To make the asn1c skeleton code a little bit clearer, I removed all changes from commit e2c05bf in file skeletons/per_opentype.c. But I added one single line in skeletons/asn_internal.h, see the EMIT_ASN_DEBUG != 1 block: #ifndef ASN_DEBUG /* If debugging code is not defined elsewhere... */
#if EMIT_ASN_DEBUG == 1 /* And it was asked to emit this code... */
#ifdef __GNUC__
#ifdef ASN_THREAD_SAFE
#define asn_debug_indent 0
#define ASN_DEBUG_INDENT_ADD(i) do{}while(0)
#else /* !ASN_THREAD_SAFE */
int asn_debug_indent;
#define ASN_DEBUG_INDENT_ADD(i) do { asn_debug_indent += i; } while(0)
#endif /* ASN_THREAD_SAFE */
#define ASN_DEBUG(fmt, args...) do { \
int adi = asn_debug_indent; \
while(adi--) fprintf(stderr, " "); \
fprintf(stderr, fmt, ##args); \
fprintf(stderr, " (%s:%d)\n", \
__FILE__, __LINE__); \
} while(0)
#else /* !__GNUC__ */
void ASN_DEBUG_f(const char *fmt, ...);
#define ASN_DEBUG ASN_DEBUG_f
#endif /* __GNUC__ */
#else /* EMIT_ASN_DEBUG != 1 */
#define ASN_DEBUG_INDENT_ADD(i) do{}while(0)
static inline void ASN_DEBUG(const char *fmt, ...) { (void)fmt; }
#endif /* EMIT_ASN_DEBUG */
#endif /* ASN_DEBUG */ |
Fixed differently, please try again. |
Thanks again vlm, |
Add OS X to the Travis CI builds
Add OS X to the Travis CI builds
As soon as ASN_THREAD_SAFE and EMIT_ASN_DEBUG=1 is set, asn_debug_indent is defined to '0' in asn_internal.h (line 39). per_opentype.c does not compile anymore in line 21, 104, 106, 156 and 158.
My setup:
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
vlm-asn1c-3d6fcfe.tar.gz
CFLAGS += -DEMIT_ASN_DEBUG=1 -D_REENTRANT
To get my compiler working I replace the asn_debug_indent variable in per_opentype.c with asn_debug_indentX. But I don't know if there are negative side-effect with the generated code now.
The text was updated successfully, but these errors were encountered: