stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r507360 - in /incubator/stdcxx/trunk/tests: self/0.printf.cpp src/printf.cpp
Date Wed, 14 Feb 2007 18:13:38 GMT
Anton Pevtsov wrote:
> Hi Martin,
> 

Hey Anton! Good to hear from you! :)

> I tried to compile the latest tests version on gcc 4.0.2/SUSE Linux 9.1
> and got the "duplicate const" error in lines
> containing VA_ARG() macro (see below).

Hmm, strangely, gcc 4.1.0 doesn't complain (and neither does
EDG eccp 3.8). It must be a bug or an unimplemented feature
in 4.0.2.

> 
> The proposed patch is attached (just remove the const qualificator).

Thanks. That would do it but I wonder if making VarArgs::pargs_
a non-const pointer and simplifying the VA_ARG() macro might
make it easier to use. Let me know if this patch works for you.

Martin

@@ -104,8 +104,8 @@

  struct VarArgs {
      union {
-        va_list    *pva_;
-        const void *pargs_;
+        va_list *pva_;
+        void    *pargs_;
      } arg_;

      enum {
@@ -115,7 +115,7 @@

  #define VA_ARG(va, T) \
      (VarArgs::VA_list == (va).kind_ ? va_arg (*(va).arg_.pva_, T) \
-                                    : *((const T*&)(va).arg_.pargs_)++)
+                                    : *((T*&)(va).arg_.pargs_)++)


  static int
@@ -2996,14 +2996,14 @@

      if ('*' == *param) {
          // extract the name of the parameter from the argument list
-        param = _RWSTD_CONST_CAST (char*, VA_ARG (*pva, const char*));
+        param = VA_ARG (*pva, char*);
      }

      char* fmtword = 0;

      if ('*' == *word) {
          // extract "word" from the argument list
-        word = _RWSTD_CONST_CAST (char*, VA_ARG (*pva, const char*));
+        word = VA_ARG (*pva, char*);
      }
      else if ('@' == *word) {
          // extract formatting directive from the argument list
@@ -3204,7 +3204,7 @@

      if (spec.mod_ext_A == spec.mod) {
          tmparg.kind_       = VarArgs::VA_array;
-        tmparg.arg_.pargs_ = VA_ARG (*pva, const void*);
+        tmparg.arg_.pargs_ = VA_ARG (*pva, void*);
      }

      int len = 0;


Mime
View raw message