From 3658d2dfd48a764503f1bb43edabef0c8af4d8d9 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 11 Feb 2013 18:53:33 +0100 Subject: [PATCH 1/2] doc: developer: Add a note about reserved system name space --- doc/developer.texi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/developer.texi b/doc/developer.texi index b3e151347e..a30cc9dfaa 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -200,6 +200,14 @@ For externally visible symbols, each library has its own prefix. Check the existing code and choose names accordingly. @end itemize +Furthermore, name space reserved for the system should not be invaded. +Identifiers ending in @code{_t} are reserved by +@url{http://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html#tag_02_02_02, POSIX}. +Also avoid names starting with @code{__} or @code{_} followed by an uppercase +letter as they are reserved by the C standard. Names starting with @code{_} +are reserved at the file level and may not be used for externally visible +symbols. If in doubt, just avoid names starting with @code{_} altogether. + @subsection Miscellaneous conventions @itemize @bullet @item From fd1abf42693308ff99b9473c2387d5142f8b3f0e Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 9 Feb 2013 22:37:07 +0100 Subject: [PATCH 2/2] lavu: avoid clashing definition of E E is usually defined as a shorthand for AV_OPT_FLAG_ENCODING_PARAM. Rename the single expansion E(x) now used in libavutil to E1. --- libavutil/internal.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavutil/internal.h b/libavutil/internal.h index 43cbaeaca2..cf18bdb700 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -59,7 +59,7 @@ // Some broken preprocessors need a second expansion // to be forced to tokenize __VA_ARGS__ -#define E(x) x +#define E1(x) x #define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \ uint8_t la_##v[sizeof(t s o) + (a)]; \ @@ -69,16 +69,16 @@ DECLARE_ALIGNED(a, t, la_##v) s o; \ t (*v) o = la_##v -#define LOCAL_ALIGNED(a, t, v, ...) E(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,)) +#define LOCAL_ALIGNED(a, t, v, ...) E1(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,)) #if HAVE_LOCAL_ALIGNED_8 -# define LOCAL_ALIGNED_8(t, v, ...) E(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)) +# define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)) #else # define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__) #endif #if HAVE_LOCAL_ALIGNED_16 -# define LOCAL_ALIGNED_16(t, v, ...) E(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,)) +# define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,)) #else # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__) #endif