diff options
author | Michael Steinert <mike.steinert@gmail.com> | 2012-05-16 12:13:31 -0600 |
---|---|---|
committer | Michael Steinert <mike.steinert@gmail.com> | 2012-05-17 11:44:46 -0600 |
commit | c921feb829e79a33938300350e61e3c3fb217968 (patch) | |
tree | b2054ac86a99fc4a52ded75826aad86e2561781b /librabbitmq/codegen.py | |
parent | 162fc19f4d896c3db862f1da303823dcbe9780ec (diff) | |
download | rabbitmq-c-github-ask-c921feb829e79a33938300350e61e3c3fb217968.tar.gz |
Set default visibility to hidden & enable a couple more warnings
Enable the following GCC options:
1. -Wstrict-prototypes
2. -Wcast-align
3. -fno-common
4. -fvisibility=hidden
This commit also includes some general cleanup of header files (mostly
for readability).
Signed-off-by: Michael Steinert <mike.steinert@gmail.com>
Diffstat (limited to 'librabbitmq/codegen.py')
-rw-r--r-- | librabbitmq/codegen.py | 88 |
1 files changed, 54 insertions, 34 deletions
diff --git a/librabbitmq/codegen.py b/librabbitmq/codegen.py index 67255a6..f805751 100644 --- a/librabbitmq/codegen.py +++ b/librabbitmq/codegen.py @@ -366,15 +366,16 @@ def genErl(spec): * ***** END LICENSE BLOCK ***** */ -#include <stdlib.h> -#include <stdint.h> -#include <string.h> -#include <stdio.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif -#include "amqp.h" -#include "amqp_framing.h" #include "amqp_private.h" #include "socket.h" +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> """ print """ @@ -551,14 +552,12 @@ def genHrl(spec): methods = spec.allMethods() print """/* Autogenerated code. Do not edit. */ -#ifndef librabbitmq_amqp_framing_h -#define librabbitmq_amqp_framing_h +#ifndef AMQP_FRAMING_H +#define AMQP_FRAMING_H #include <amqp.h> -#ifdef __cplusplus -extern "C" { -#endif +AMQP_BEGIN_DECLS """ print "#define AMQP_PROTOCOL_VERSION_MAJOR %d" % (spec.major) print "#define AMQP_PROTOCOL_VERSION_MINOR %d" % (spec.minor) @@ -571,24 +570,47 @@ extern "C" { print """/* Function prototypes. */ -extern char const *amqp_constant_name(int constantNumber); -extern amqp_boolean_t amqp_constant_is_hard_error(int constantNumber); -RABBITMQ_EXPORT char const *amqp_method_name(amqp_method_number_t methodNumber); -extern amqp_boolean_t amqp_method_has_content(amqp_method_number_t methodNumber); -extern int amqp_decode_method(amqp_method_number_t methodNumber, - amqp_pool_t *pool, - amqp_bytes_t encoded, - void **decoded); -extern int amqp_decode_properties(uint16_t class_id, - amqp_pool_t *pool, - amqp_bytes_t encoded, - void **decoded); -extern int amqp_encode_method(amqp_method_number_t methodNumber, - void *decoded, - amqp_bytes_t encoded); -extern int amqp_encode_properties(uint16_t class_id, - void *decoded, - amqp_bytes_t encoded); +AMQP_PUBLIC +char const * +amqp_constant_name(int constantNumber); + +AMQP_PUBLIC +amqp_boolean_t +amqp_constant_is_hard_error(int constantNumber); + +AMQP_PUBLIC +char const * +amqp_method_name(amqp_method_number_t methodNumber); + +AMQP_PUBLIC +amqp_boolean_t +amqp_method_has_content(amqp_method_number_t methodNumber); + +AMQP_PUBLIC +int +amqp_decode_method(amqp_method_number_t methodNumber, + amqp_pool_t *pool, + amqp_bytes_t encoded, + void **decoded); + +AMQP_PUBLIC +int +amqp_decode_properties(uint16_t class_id, + amqp_pool_t *pool, + amqp_bytes_t encoded, + void **decoded); + +AMQP_PUBLIC +int +amqp_encode_method(amqp_method_number_t methodNumber, + void *decoded, + amqp_bytes_t encoded); + +AMQP_PUBLIC +int +amqp_encode_properties(uint16_t class_id, + void *decoded, + amqp_bytes_t encoded); """ print "/* Method field records. */\n" @@ -625,14 +647,12 @@ extern int amqp_encode_properties(uint16_t class_id, for m in methods: if m.isSynchronous and apiMethodInfo.get(m.fullName()) is not False: - print "RABBITMQ_EXPORT %s;" % (m.apiPrototype(),) + print "AMQP_PUBLIC\n%s;" % (m.apiPrototype(),) print """ -#ifdef __cplusplus -} -#endif +AMQP_END_DECLS -#endif""" +#endif /* AMQP_FRAMING_H */""" def generateErl(specPath): genErl(AmqpSpec(specPath)) |