[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: aptitude patterns & aptitude backport (was: Re: Upgrade to etch save?)



On Sun, 2007-03-18 at 11:28 +0000, Sam Morris wrote:
<snip>
> Has anyone managed to backport aptitude to sarge? I just tried it now but
> cannot get it to compile. g++ dies on line 72 of
> src/generic/apt/matchers.cc, right after some weird GCC-specific attribute
> is used... perhaps GCC 3.3 does not understand it?

g++ 3.3 does support it but does not seem to be able to parse
__attribute__ labels on function definitions; only on non-defining
declarations.  Since the attribute is only there to produce warnings for
callers that don't use a matching format string and argument types, it
can safely be removed.

There was another case like this, and a few cases where g++ 3.3
instantiates functions early and requires full class definitions that
haven't been included.

The following changes allowed me to compile aptitude-0.4.4 in sarge plus
backported apt:

--- aptitude-0.4.4.orig/src/load_grouppolicy.cc
+++ aptitude-0.4.4/src/load_grouppolicy.cc
@@ -51,7 +51,7 @@
 public:
   GroupParseException(const char *format,
 		      ...)
-#ifdef __GNUG__
+#if (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 304
     __attribute__ ((format (printf, 2, 3)))
 #endif
   {
--- aptitude-0.4.4.orig/src/pkg_view.h
+++ aptitude-0.4.4/src/pkg_view.h
@@ -30,6 +30,7 @@
 #include "vscreen/ref_ptr.h"
 #include "vscreen/config/column_definition.h"
 #include "vscreen/config/style.h"
+#include "vscreen/vscreen_widget.h"
 #include "pkg_grouppolicy.h"
 
 #include <list>
@@ -38,7 +39,6 @@
 class menu_redirect;
 class package_view_item;
 class pkg_grouppolicy_factory;
-class vscreen_widget;
 typedef ref_ptr<vscreen_widget> vs_widget_ref;
 
 // The available types of items are:
--- aptitude-0.4.4.orig/src/generic/apt/matchers.cc
+++ aptitude-0.4.4/src/generic/apt/matchers.cc
@@ -66,7 +66,7 @@
 public:
   CompilationException(const char *format,
 		       ...)
-#ifdef __GNUG__
+#if (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 304
     __attribute__ ((format (printf, 2, 3)))
 #endif
   {
--- aptitude-0.4.4.orig/src/vscreen/vs_radiogroup.h
+++ aptitude-0.4.4/src/vscreen/vs_radiogroup.h
@@ -24,14 +24,13 @@
 #define VS_RADIOGROUP_H
 
 #include "ref_ptr.h"
+#include "vs_togglebutton.h"
 
 #include <vector>
 
 #include <sigc++/connection.h>
 #include <sigc++/trackable.h>
 
-class vs_togglebutton;
-
 class vs_radiogroup:public sigc::trackable
 {
   struct item
--- aptitude-0.4.4.orig/src/vscreen/vs_menubar.h
+++ aptitude-0.4.4/src/vscreen/vs_menubar.h
@@ -25,13 +25,12 @@
 
 #include "vscreen_widget.h"
 #include "vs_container.h"
+#include "vs_menu.h"
 #include "config/keybindings.h"
 
 #include <string>
 #include <vector>
 
-class vs_menu;
-
 typedef ref_ptr<vs_menu> vs_menu_ref;
 
 class vs_menubar:public vs_container
-- END --

These changes should be compatible with later versions of g++, though I
haven't tested that.  I'll leave it to someone else to test and upload.
Oh, there's also some kind of documentation format error that I can't
interpret:

po4a-translate -M utf-8 -f docbook -m ./../en/aptitude.xml -p ./../po4a/po/fr.po -l aptitude.xml
Use of uninitialized value in regexp compilation at /usr/share/perl5/Locale/Po4a/Xml.pm line 402.
./../en/aptitude.xml:7976: (po4a::xml)
               Bad attribute syntax

Ben.

-- 
Ben Hutchings
Teamwork is essential - it allows you to blame someone else.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: