Fix build with bleeding edge GLib

CTags defines __unused__ and __printf__, which not only are reserved
identifiers, but actually are used by GNUC as arguments of the
__attribute__() extension.  This used to work because no code seeing
those definitions was trying to use them as __attribute__() argument,
but a recent change in GLib made it use it in atomic operation, which
are used by the tagmanager, which itself includes the CTags header
defining those, leading to a weird build failure -- since __unused__
expanded to an unexpected value.

To fix this, rename CTag's __ununsed__ to UNUSED and __printf__ to
PRINTF.
This commit is contained in:
Colomban Wendling 2013-02-12 23:48:10 +01:00
parent 76a6e945ec
commit 1646504a46
13 changed files with 32 additions and 32 deletions

View File

@ -735,7 +735,7 @@ static const char *keywordString (const keywordId keyword)
return name;
}
static void __unused__ pt (tokenInfo *const token)
static void UNUSED pt (tokenInfo *const token)
{
if (isType (token, TOKEN_NAME))
printf("type: %-12s: %-13s line: %lu\n",
@ -750,7 +750,7 @@ static void __unused__ pt (tokenInfo *const token)
tokenString (token->type), token->lineNumber);
}
static void __unused__ ps (statementInfo *const st)
static void UNUSED ps (statementInfo *const st)
{
unsigned int i;
printf("scope: %s decl: %s gotName: %s gotParenName: %s\n",

View File

@ -892,7 +892,7 @@ extern vString *combinePathAndFile (const char *const path,
* Create tags
*/
extern void processExcludeOption (const char *const __unused__ option,
extern void processExcludeOption (const char *const UNUSED option,
const char *const parameter)
{
if (parameter [0] == '\0')
@ -1328,7 +1328,7 @@ static void setExecutableName (const char *const path)
#endif
}
extern int ctags_main (int __unused__ argc, char **argv)
extern int ctags_main (int UNUSED argc, char **argv)
{
cookedArgs *args;
#ifdef VMS

View File

@ -31,11 +31,11 @@
* to prevent warnings about unused variables.
*/
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !(defined (__APPLE_CC__) || defined (__GNUG__))
# define __unused__ __attribute__((unused))
# define __printf__(s,f) __attribute__((format (printf, s, f)))
# define UNUSED __attribute__((unused))
# define PRINTF(s,f) __attribute__((format (printf, s, f)))
#else
# define __unused__
# define __printf__(s,f)
# define UNUSED
# define PRINTF(s,f)
#endif

View File

@ -538,11 +538,11 @@ extern void findRegexTags (void)
#endif /* HAVE_REGEX */
extern void addTagRegex (
const langType language __unused__,
const char* const regex __unused__,
const char* const name __unused__,
const char* const kinds __unused__,
const char* const flags __unused__)
const langType language UNUSED,
const char* const regex UNUSED,
const char* const name UNUSED,
const char* const kinds UNUSED,
const char* const flags UNUSED)
{
#ifdef HAVE_REGEX
Assert (regex != NULL);
@ -564,10 +564,10 @@ extern void addTagRegex (
}
extern void addCallbackRegex (
const langType language __unused__,
const char* const regex __unused__,
const char* const flags __unused__,
const regexCallback callback __unused__)
const langType language UNUSED,
const char* const regex UNUSED,
const char* const flags UNUSED,
const regexCallback callback UNUSED)
{
#ifdef HAVE_REGEX
Assert (regex != NULL);
@ -581,7 +581,7 @@ extern void addCallbackRegex (
}
extern void addLanguageRegex (
const langType language __unused__, const char* const regex __unused__)
const langType language UNUSED, const char* const regex UNUSED)
{
#ifdef HAVE_REGEX
if (! regexBroken)
@ -602,7 +602,7 @@ extern void addLanguageRegex (
*/
extern boolean processRegexOption (const char *const option,
const char *const parameter __unused__)
const char *const parameter UNUSED)
{
boolean handled = FALSE;
const char* const dash = strchr (option, '-');
@ -624,7 +624,7 @@ extern boolean processRegexOption (const char *const option,
return handled;
}
extern void disableRegexKinds (const langType language __unused__)
extern void disableRegexKinds (const langType language UNUSED)
{
#ifdef HAVE_REGEX
if (language <= SetUpper && Sets [language].count > 0)
@ -639,8 +639,8 @@ extern void disableRegexKinds (const langType language __unused__)
}
extern boolean enableRegexKind (
const langType language __unused__,
const int kind __unused__, const boolean mode __unused__)
const langType language UNUSED,
const int kind UNUSED, const boolean mode UNUSED)
{
boolean result = FALSE;
#ifdef HAVE_REGEX
@ -660,7 +660,7 @@ extern boolean enableRegexKind (
return result;
}
extern void printRegexKinds (const langType language __unused__, boolean indent __unused__)
extern void printRegexKinds (const langType language UNUSED, boolean indent UNUSED)
{
#ifdef HAVE_REGEX
if (language <= SetUpper && Sets [language].count > 0)

View File

@ -34,7 +34,7 @@ static kindOption LuaKinds [] = {
*/
/* for debugging purposes */
static void __unused__ print_string (char *p, char *q)
static void UNUSED print_string (char *p, char *q)
{
for ( ; p != q; p++)
fprintf (errout, "%c", *p);

View File

@ -41,7 +41,7 @@ extern void *malloc (size_t);
extern void *realloc (void *ptr, size_t);
#endif
extern void error (const errorSelection selection, const char *const format, ...) __printf__ (2, 3);
extern void error (const errorSelection selection, const char *const format, ...) PRINTF (2, 3);
extern FILE *tempFile (const char *const mode, char **const pName);
extern char* eStrdup (const char* str);
extern void *eMalloc (const size_t size);

View File

@ -93,7 +93,7 @@ extern CONST_OPTION optionValues Option;
/*
* FUNCTION PROTOTYPES
*/
extern void verbose (const char *const format, ...) __printf__ (1, 2);
extern void verbose (const char *const format, ...) PRINTF (1, 2);
extern void freeList (stringList** const pString);
extern void setDefaultTagFileName (void);

View File

@ -355,7 +355,7 @@ extern void freeParserResources (void)
*/
extern void processLanguageDefineOption (const char *const option,
const char *const __unused__ parameter)
const char *const UNUSED parameter)
{
#ifdef HAVE_REGEX
if (parameter [0] == '\0')

View File

@ -120,7 +120,7 @@ extern boolean processRegexOption (const char *const option, const char *const p
extern void addLanguageRegex (const langType language, const char* const regex);
extern void addTagRegex (const langType language, const char* const regex, const char* const name, const char* const kinds, const char* const flags);
extern void addCallbackRegex (const langType language, const char* const regex, const char* flags, const regexCallback callback);
extern void disableRegexKinds (const langType __unused__ language);
extern void disableRegexKinds (const langType UNUSED language);
extern boolean enableRegexKind (const langType language, const int kind, const boolean mode);
extern void printRegexKindOptions (const langType language);
extern void freeRegexResources (void);

View File

@ -32,7 +32,7 @@
#define FILE_FREE(T) g_slice_free(TMFileEntry, (T))
void tm_file_entry_print(TMFileEntry *entry, gpointer __unused__ user_data
void tm_file_entry_print(TMFileEntry *entry, gpointer UNUSED user_data
, guint level)
{
guint i;

View File

@ -473,7 +473,7 @@ gboolean tm_project_save(TMProject *project)
}
static void tm_project_add_file_recursive(TMFileEntry *entry
, gpointer user_data, guint __unused__ level)
, gpointer user_data, guint UNUSED level)
{
TMProject *project;
if (!user_data || !entry || (tm_file_dir_t == entry->type))

View File

@ -265,7 +265,7 @@ int tm_source_file_tags(const tagEntryInfo *tag)
}
gboolean tm_source_file_update(TMWorkObject *source_file, gboolean force
, gboolean __unused__ recurse, gboolean update_parent)
, gboolean UNUSED recurse, gboolean update_parent)
{
if (force)
{

View File

@ -517,7 +517,7 @@ void tm_workspace_recreate_tags_array(void)
}
gboolean tm_workspace_update(TMWorkObject *workspace, gboolean force
, gboolean recurse, gboolean __unused__ update_parent)
, gboolean recurse, gboolean UNUSED update_parent)
{
guint i;
gboolean update_tags = force;