Ticket #1188 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] headers: clean up #includes

Reported by: bpowers Owned by:
Milestone: Component: library
Severity: minor Keywords:
Cc: Blocking:
Blocked By:

Description

This both reduces noise and fixes a build error from my distro's gcc 4.7.

Attachments

headers__clean_up__includes.patch Download (1.6 KB) - added by bpowers 2 years ago.

Change History

Changed 2 years ago by bpowers

comment:1 Changed 2 years ago by ales

Does not compile with gcc 4.2.1 (Apple). Fails in hclust.cpp with

/usr/include/c++/4.2.1/bits/localefwd.h:58:34: error: macro "isspace" passed 2 arguments, but takes just 1
... (More similar errors)

This is a very common error triggered by a clash between isspace template and macro definition, and depends on the include order. I will try to track down the change that caused it.

comment:2 Changed 2 years ago by lanz

I can confirm that it does not compile cleanly using gcc 4.7, so something needs to be fixed.

Edit: Orange as it is does not compile well with 4.7, I haven't tried the patch yet.

Last edited 2 years ago by lanz (previous) (diff)

comment:3 Changed 2 years ago by bpowers

I attached a patch that fixes things. Let me know if it doesn't work, I happily offer it under the GPLv3.

comment:4 Changed 2 years ago by bpowers

oh, I see what you mean with that comment. I'll take a look

comment:5 Changed 2 years ago by bpowers

my change was initially tested on top of b8aa6191819f (mitar: Removed hard-coded version) on Fedora 17. I just tried building it on Mac 10.6/gcc 4.2.1:

alfonso:orange bobby$ gcc --version | head -n 1; python --version; uname -a
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Python 2.6.1
Darwin alfonso.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

I had to export CFLAGS='-arch 386 -arch x86_64' to get it to not compile for ppc, but other than that it built and installed fine.

@ales - what version of OSX are you running? maybe you have some other patch that affects this?

comment:6 Changed 2 years ago by ales

$ gcc --version | head -n 1; python --version; uname -a
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Python 2.7.3
Darwin ales-erjavecs-macbook-pro.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

Note the python version (this happens with both fink's python as well as the python included in the Orange Mac OSX bundle). Otherwise it compiles fine for default system python (2.6.1).

The full error is

In file included from /usr/include/c++/4.2.1/ios:47,
                 from /usr/include/c++/4.2.1/ostream:45,
                 from /usr/include/c++/4.2.1/iterator:70,
                 from /usr/include/c++/4.2.1/tr1/hashtable:57,
                 from /usr/include/c++/4.2.1/tr1/unordered_map:37,
                 from source/orange/hclust.cpp:666:
/usr/include/c++/4.2.1/bits/localefwd.h:58:34: error: macro "isspace" passed 2 arguments, but takes just 1
/usr/include/c++/4.2.1/bits/localefwd.h:70:34: error: macro "isupper" passed 2 arguments, but takes just 1
/usr/include/c++/4.2.1/bits/localefwd.h:74:34: error: macro "islower" passed 2 arguments, but takes just 1
/usr/include/c++/4.2.1/bits/localefwd.h:78:34: error: macro "isalpha" passed 2 arguments, but takes just 1
/usr/include/c++/4.2.1/bits/localefwd.h:94:34: error: macro "isalnum" passed 2 arguments, but takes just 1
/usr/include/c++/4.2.1/bits/localefwd.h:102:34: error: macro "toupper" passed 2 arguments, but takes just 1
/usr/include/c++/4.2.1/bits/localefwd.h:106:34: error: macro "tolower" passed 2 arguments, but takes just 1

using your patch applied on the current repo tip r3c31daaf34ae

$ hg log -l2
changeset:   10887:43fcaa1ba432
tag:         headers__clean_up__includes.patch
tag:         qbase
tag:         qtip
tag:         tip
user:        Bobby Powers <bobby@socialcodeinc.com>
date:        Wed May 23 00:40:23 2012 -0400
summary:     headers: clean up #includes

changeset:   10886:3c31daaf34ae
tag:         qparent
user:        markotoplak
date:        Wed May 23 16:12:22 2012 +0200
summary:     Added logistic regression with LinearLearner to the rst documentation.

comment:7 Changed 2 years ago by ales

Ok. It compiles fine if I move the unordered_map include to the beginning (before any other includes).

comment:8 Changed 2 years ago by Ales Erjavec <ales.erjavec@…>

In [4296caed2ecda61eb4087ce57e120e3c08e7f48b/orange]:

Moved unordered_map include to the top (see #1188)

comment:9 Changed 2 years ago by ales

  • Status changed from new to closed
  • Resolution set to fixed

Patch has been included in 43fcaa1ba432

comment:10 Changed 2 years ago by bpowers

great, thanks!

Note: See TracTickets for help on using tickets.