From 9067d19b9aaf673283ee6530b1c4c2909f88c5e8 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 1 Aug 2014 15:48:37 +0000 Subject: headers: properly decorate attributes As pointed out here: https://cygwin.com/ml/cygwin/2014-07/msg00371.html any use of __attribute__ in a header that can be included by a user should be namespace-safe, by decorating the attribute arguments with __ (while gcc does a lousy job at documenting it, ALL attributes have a __ counterpart, precisely so that public headers can use attributes without risk of collision with macros belonging to user namespace). * include/pthread.h: Decorate attribute names with __, for namespace safety. * include/cygwin/core_dump.h: Likewise. * include/cygwin/cygwin_dll.h: Likewise. * include/sys/cygwin.h: Likewise. * include/sys/strace.h: Likewise. --- winsup/cygwin/ChangeLog | 9 +++++++++ winsup/cygwin/include/cygwin/core_dump.h | 10 +++++----- winsup/cygwin/include/cygwin/cygwin_dll.h | 8 ++++---- winsup/cygwin/include/pthread.h | 6 +++--- winsup/cygwin/include/sys/cygwin.h | 16 ++++++++-------- winsup/cygwin/include/sys/strace.h | 14 +++++++------- 6 files changed, 36 insertions(+), 27 deletions(-) (limited to 'winsup/cygwin') diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 18790fe70..d10cfbcc4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2014-07-31 Eric Blake + + * include/pthread.h: Decorate attribute names with __, for + namespace safety. + * include/cygwin/core_dump.h: Likewise. + * include/cygwin/cygwin_dll.h: Likewise. + * include/sys/cygwin.h: Likewise. + * include/sys/strace.h: Likewise. + 2014-07-30 Corinna Vinschen * uinfo.cc (pwdgrp::fetch_account_from_windows): Fix comment. diff --git a/winsup/cygwin/include/cygwin/core_dump.h b/winsup/cygwin/include/cygwin/core_dump.h index b1943937b..57d90b750 100644 --- a/winsup/cygwin/include/cygwin/core_dump.h +++ b/winsup/cygwin/include/cygwin/core_dump.h @@ -1,6 +1,6 @@ /* core_dump.h - Copyright 1999, 2000, 2001 Red Hat, Inc. + Copyright 1999, 2000, 2001, 2014 Red Hat, Inc. Written by Egor Duda @@ -27,7 +27,7 @@ struct win32_core_process_info char command_line[1]; } #ifdef __GNUC__ - __attribute__ ((packed)) + __attribute__ ((__packed__)) #endif ; @@ -38,7 +38,7 @@ struct win32_core_thread_info CONTEXT thread_context; } #ifdef __GNUC__ - __attribute__ ((packed)) + __attribute__ ((__packed__)) #endif ; @@ -49,7 +49,7 @@ struct win32_core_module_info char module_name[1]; } #ifdef __GNUC__ - __attribute__ ((packed)) + __attribute__ ((__packed__)) #endif ; @@ -64,7 +64,7 @@ struct win32_pstatus } data ; } #ifdef __GNUC__ - __attribute__ ((packed)) + __attribute__ ((__packed__)) #endif ; diff --git a/winsup/cygwin/include/cygwin/cygwin_dll.h b/winsup/cygwin/include/cygwin/cygwin_dll.h index d3da87ddd..908858c17 100644 --- a/winsup/cygwin/include/cygwin/cygwin_dll.h +++ b/winsup/cygwin/include/cygwin/cygwin_dll.h @@ -1,6 +1,6 @@ /* cygwin_dll.h - Copyright 1998, 1999, 2000, 2001, 2009, 2011, 2012, 2013 Red Hat, Inc. + Copyright 1998, 1999, 2000, 2001, 2009, 2011, 2012, 2013, 2014 Red Hat, Inc. This file is part of Cygwin. @@ -35,9 +35,9 @@ static DWORD storedReason; \ static void* storedPtr; \ int __dynamically_loaded; \ \ -static int __dllMain (int a __attribute__ ((unused)), \ - char **b __attribute__ ((unused)), \ - char **c __attribute__ ((unused))) \ +static int __dllMain (int a __attribute__ ((__unused__)), \ + char **b __attribute__ ((__unused__)), \ + char **c __attribute__ ((__unused__))) \ { \ return Entry (storedHandle, storedReason, storedPtr); \ } \ diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h index 9170d96fc..9ad8b6662 100644 --- a/winsup/cygwin/include/pthread.h +++ b/winsup/cygwin/include/pthread.h @@ -76,7 +76,7 @@ int pthread_attr_getschedpolicy (const pthread_attr_t *, int *); int pthread_attr_getscope (const pthread_attr_t *, int *); int pthread_attr_getstack (const pthread_attr_t *, void **, size_t *); int pthread_attr_getstackaddr (const pthread_attr_t *, void **) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); int pthread_attr_init (pthread_attr_t *); int pthread_attr_setdetachstate (pthread_attr_t *, int); int pthread_attr_setguardsize (pthread_attr_t *, size_t); @@ -88,7 +88,7 @@ int pthread_attr_setscope (pthread_attr_t *, int); #ifdef _POSIX_THREAD_ATTR_STACKADDR int pthread_attr_setstack (pthread_attr_t *, void *, size_t); int pthread_attr_setstackaddr (pthread_attr_t *, void *) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); #endif #ifdef _POSIX_THREAD_ATTR_STACKSIZE @@ -137,7 +137,7 @@ int pthread_create (pthread_t *, const pthread_attr_t *, void *(*)(void *), void *); int pthread_detach (pthread_t); int pthread_equal (pthread_t, pthread_t); -void pthread_exit (void *) __attribute__ ((noreturn)); +void pthread_exit (void *) __attribute__ ((__noreturn__)); int pthread_getcpuclockid (pthread_t, clockid_t *); int pthread_getschedparam (pthread_t, int *, struct sched_param *); void *pthread_getspecific (pthread_key_t); diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h index 7e344ecab..39639b877 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -26,21 +26,21 @@ extern "C" { /* DEPRECATED INTERFACES. These are restricted to MAX_PATH length. Don't use in modern applications. They don't exist on x86_64. */ extern int cygwin_win32_to_posix_path_list (const char *, char *) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); extern int cygwin_win32_to_posix_path_list_buf_size (const char *) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); extern int cygwin_posix_to_win32_path_list (const char *, char *) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); extern int cygwin_posix_to_win32_path_list_buf_size (const char *) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); extern int cygwin_conv_to_win32_path (const char *, char *) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); extern int cygwin_conv_to_full_win32_path (const char *, char *) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); extern int cygwin_conv_to_posix_path (const char *, char *) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); extern int cygwin_conv_to_full_posix_path (const char *, char *) - __attribute__ ((deprecated)); + __attribute__ ((__deprecated__)); #endif /* !__x86_64__ */ /* Use these interfaces in favor of the above. */ diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h index 164af1e50..eacd3f113 100644 --- a/winsup/cygwin/include/sys/strace.h +++ b/winsup/cygwin/include/sys/strace.h @@ -1,7 +1,7 @@ /* sys/strace.h Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, - 2010, 2011, 2012 Red Hat, Inc. + 2010, 2011, 2012, 2014 Red Hat, Inc. This file is part of Cygwin. @@ -40,17 +40,17 @@ class strace void write (unsigned category, const char *buf, int count); unsigned char _active; public: - void activate (bool) __attribute__ ((regparm (2)));; + void activate (bool) __attribute__ ((__regparm__ (2)));; strace () {} int microseconds (); int version; int lmicrosec; bool execing; - void dll_info () __attribute__ ((regparm (1))); - void prntf (unsigned, const char *func, const char *, ...) /*__attribute__ ((regparm(3)))*/; - void vprntf (unsigned, const char *func, const char *, va_list ap) /*__attribute__ ((regparm(3)))*/; - void wm (int message, int word, int lon) __attribute__ ((regparm(3))); - void write_childpid (pid_t) __attribute__ ((regparm (3))); + void dll_info () __attribute__ ((__regparm__ (1))); + void prntf (unsigned, const char *func, const char *, ...) /*__attribute__ ((__regparm__(3)))*/; + void vprntf (unsigned, const char *func, const char *, va_list ap) /*__attribute__ ((__regparm__(3)))*/; + void wm (int message, int word, int lon) __attribute__ ((__regparm__(3))); + void write_childpid (pid_t) __attribute__ ((__regparm__ (3))); bool attached () const {return _active == 3;} bool active () const {return _active & 1;} unsigned char& active_val () {return _active;} -- cgit v1.2.3