While building rsync 2.6.2 on my x86 Linux system using gcc 3.3.3, I
observed a number of warnings from popt.c/h about ignoring qualifiers
on return types.  On further investigation, it looks like a few
functions are declaring their return types as "const char * const".
The first const is appropriate ("the chars pointed to by this pointer
are const"), but the second is bogus ("the value returned is const",
which is meaningless since the value is copied) and is the cause of
the warnings.

The patch below removes the spurious consts and silences the warnings.

                                                         Jeremy

diff -uwr rsync-2.6.2-old/popt/popt.c rsync-2.6.2/popt/popt.c
--- rsync-2.6.2-old/popt/popt.c 2004-01-27 10:27:05.000000000 -0600
+++ rsync-2.6.2/popt/popt.c     2004-05-02 13:22:53.000000000 -0500
@@ -1128,7 +1128,7 @@
     /[EMAIL PROTECTED]@*/
 }

-const char *const poptStrerror(const int error)
+const char * poptStrerror(const int error)
 {
     switch (error) {
       case POPT_ERROR_NOARG:
diff -uwr rsync-2.6.2-old/popt/popt.h rsync-2.6.2/popt/popt.h
--- rsync-2.6.2-old/popt/popt.h 2004-01-27 10:27:05.000000000 -0600
+++ rsync-2.6.2/popt/popt.h     2004-05-02 13:23:01.000000000 -0500
@@ -373,7 +373,7 @@
  * @return             error string
  */
 /[EMAIL PROTECTED]@*/
-/[EMAIL PROTECTED]@*/ const char *const poptStrerror(const int error)
+/[EMAIL PROTECTED]@*/ const char * poptStrerror(const int error)
        /[EMAIL PROTECTED]/;
 /[EMAIL PROTECTED]@*/

diff -uwr rsync-2.6.2-old/popt/popthelp.c rsync-2.6.2/popt/popthelp.c
--- rsync-2.6.2-old/popt/popthelp.c     2004-01-27 10:27:05.000000000 -0600
+++ rsync-2.6.2/popt/popthelp.c 2004-05-02 13:23:52.000000000 -0500
@@ -63,7 +63,7 @@
 /**
  * @param table                option(s)
  */
-/[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/ static const char *const
+/[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/ static const char *
 getTableTranslationDomain(/[EMAIL PROTECTED]@*/ const struct poptOption *table)
        /[EMAIL PROTECTED]/
 {
@@ -81,7 +81,7 @@
  * @param opt          option(s)
  * @param translation_domain   translation domain
  */
-/[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/ static const char *const
+/[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/ static const char *
 getArgDescrip(const struct poptOption * opt,
                /[EMAIL PROTECTED]@*/           /* FIX: wazzup? */
                /[EMAIL PROTECTED]@*/ UNUSED(const char * translation_domain))
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to