Opened 14 years ago

Closed 14 years ago

#5892 closed bug (fixed)

clang build fixes part 1 [patch]

Reported by: kaliber Owned by: nobody
Priority: normal Milestone: R1
Component: - General Version: R1/Development
Keywords: clang Cc:
Blocked By: Blocking:
Platform: All

Description

This patch is gcc2 and gcc4 compatible.

Attachments (3)

haiku-clang-build-fixes.patch (5.0 KB ) - added by kaliber 14 years ago.
updated patch
haiku-clang-build-fixes-updated.patch (3.1 KB ) - added by stippi 14 years ago.
Updated patch with the applied stuff removed.
haiku-clang-build-fixes-updated-2.patch (2.6 KB ) - added by kaliber 14 years ago.
Updated patch with the applied stuff and math.h changes removed.

Download all attachments as: .zip

Change History (15)

comment:1 by stippi, 14 years ago

The change to headers/posix/fenv.h is definitely not correct/complete, since clang != x86. Doesn't clang define _x86_? Looks like it should for compatibility reasons, so this should be fixed in the clang build for Haiku.

in reply to:  1 comment:2 by kaliber, 14 years ago

Replying to stippi:

The change to headers/posix/fenv.h is definitely not correct/complete, since clang != x86. Doesn't clang define _x86_? Looks like it should for compatibility reasons, so this should be fixed in the clang build for Haiku.

It's looks like _X86_ is non standard define. Haiku uses _INTEL_ in many places, for example http://dev.haiku-os.org/browser/haiku/trunk/headers/os/kernel/OS.h#L407 So we really should switch to _INTEL_ from _X86_.

by kaliber, 14 years ago

updated patch

comment:3 by nielx, 14 years ago

patch: 1

comment:4 by kaliber, 14 years ago

Can someone review and apply the patch?

by stippi, 14 years ago

Updated patch with the applied stuff removed.

comment:5 by stippi, 14 years ago

I have applied the obviously correct hunks in hrev36906, hrev36907, hrev36908 and hrev36909. For the rest, I would like someone else to review, because I don't know if some of the stuff is actually problems in clang (which may even have been fixed in more recent versions). Especially the math.h hunk seems weird to me.

in reply to:  5 comment:6 by kaliber, 14 years ago

Replying to stippi:

I have applied the obviously correct hunks in hrev36906, hrev36907, hrev36908 and hrev36909. For the rest, I would like someone else to review, because I don't know if some of the stuff is actually problems in clang (which may even have been fixed in more recent versions). Especially the math.h hunk seems weird to me.

Actually, math.h hunk fixes a warning "warning: use of GNU old-style field designator extension", so it can be skipped for now. More info: http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html#Designated-Inits

by kaliber, 14 years ago

Updated patch with the applied stuff and math.h changes removed.

comment:7 by kaliber, 14 years ago

I've updated patch and dropped math.h changes. See #6230 for more details.

comment:8 by kaliber, 14 years ago

Here is clang output, hopefully it helps:

C++ generated/objects/haiku/x86/release/preferences/cpufrequency/main.o 
In file included from src/preferences/cpufrequency/main.cpp:14:
In file included from src/preferences/cpufrequency/CPUFrequencyView.h:14:
src/preferences/cpufrequency/PreferencesWindow.h:369:2: error: use of undeclared identifier 'SetWindowPosition'
        SetWindowPosition(Frame().LeftTop());
        ^
        this->
src/preferences/cpufrequency/main.cpp:28:15: note: in instantiation of member function
      'PreferencesWindow<freq_preferences>::~PreferencesWindow' requested here
        window = new PreferencesWindow<freq_preferences>(
                     ^
In file included from src/preferences/cpufrequency/main.cpp:14:
In file included from src/preferences/cpufrequency/CPUFrequencyView.h:14:
src/preferences/cpufrequency/PreferencesWindow.h:55:12: note: must qualify identifier to find this declaration in dependent
      base class
                        void                            SetWindowPosition(BPoint position)
                                                        ^
1 error generated.

--------------------------------------

C++ generated/objects/haiku/x86/release/libs/print/libprint/PackBits.o 
src/libs/print/libprint/PackBits.cpp:17:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;

--------------------------------------

In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:27:
headers/private/kernel/util/MultiHashTable.h:168:24: error: use of undeclared identifier '_Link'
                                        ValueType *next = _Link(bucket);
                                                          ^
                                                          this->
headers/private/kernel/util/MultiHashTable.h:49:4: note: in instantiation of member function
      'MultiHashTable<MulticastStateHash, 1, 0>::_Resize' requested here
                        _Resize(HashTable::fTableSize * 2);
                        ^
src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:779:19: note: in instantiation of member function
      'MultiHashTable<MulticastStateHash, 1, 0>::Insert' requested here
        sMulticastState->Insert(state);
                         ^
In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:11:
In file included from src/add-ons/kernel/network/protocols/ipv4/multicast.h:13:
headers/private/kernel/util/OpenHashTable.h:429:14: note: must qualify identifier to find this declaration in dependent base
      class
        ValueType*& _Link(ValueType* bucket) const
                    ^
In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:27:
headers/private/kernel/util/MultiHashTable.h:146:4: error: use of undeclared identifier '_Link'
                        _Link(value) = _Link(previous);
                        ^
                        this->
headers/private/kernel/util/MultiHashTable.h:169:6: note: in instantiation of member function
      'MultiHashTable<MulticastStateHash, 1, 0>::_Insert' requested here
                                        _Insert(newTable, newSize, bucket);
                                        ^
headers/private/kernel/util/MultiHashTable.h:49:4: note: in instantiation of member function
      'MultiHashTable<MulticastStateHash, 1, 0>::_Resize' requested here
                        _Resize(HashTable::fTableSize * 2);
                        ^
src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:779:19: note: in instantiation of member function
      'MultiHashTable<MulticastStateHash, 1, 0>::Insert' requested here
        sMulticastState->Insert(state);
                         ^
In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:11:
In file included from src/add-ons/kernel/network/protocols/ipv4/multicast.h:13:
headers/private/kernel/util/OpenHashTable.h:429:14: note: must qualify identifier to find this declaration in dependent base
      class
        ValueType*& _Link(ValueType* bucket) const
                    ^
In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:27:
headers/private/kernel/util/MultiHashTable.h:146:19: error: use of undeclared identifier '_Link'
                        _Link(value) = _Link(previous);
                                       ^
                                       this->
In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:11:
In file included from src/add-ons/kernel/network/protocols/ipv4/multicast.h:13:
headers/private/kernel/util/OpenHashTable.h:429:14: note: must qualify identifier to find this declaration in dependent base
      class
        ValueType*& _Link(ValueType* bucket) const
                    ^
In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:27:
headers/private/kernel/util/MultiHashTable.h:147:4: error: use of undeclared identifier '_Link'
                        _Link(previous) = value;
                        ^
                        this->
In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:11:
In file included from src/add-ons/kernel/network/protocols/ipv4/multicast.h:13:
headers/private/kernel/util/OpenHashTable.h:429:14: note: must qualify identifier to find this declaration in dependent base
      class
        ValueType*& _Link(ValueType* bucket) const
                    ^
In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:27:
headers/private/kernel/util/MultiHashTable.h:149:4: error: use of undeclared identifier '_Link'
                        _Link(value) = table[index];
                        ^
                        this->
In file included from src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp:11:
In file included from src/add-ons/kernel/network/protocols/ipv4/multicast.h:13:
headers/private/kernel/util/OpenHashTable.h:429:14: note: must qualify identifier to find this declaration in dependent base
      class
        ValueType*& _Link(ValueType* bucket) const
                    ^
1 warning and 5 errors generated.

--------------------------------------

C++ generated/objects/haiku/x86/release/kits/locale/DefaultCatalog.o 
In file included from src/kits/locale/DefaultCatalog.cpp:27:
In file included from headers/private/locale/DefaultCatalog.h:10:
In file included from headers/private/locale/HashMapCatalog.h:19:
headers/private/shared/HashMap.h:461:29: error: no struct named 'Element' in 'HashMap<Key, Value>'
struct HashMap<Key, Value>::Element *
                            ^
1 error generated.

comment:9 by tqh, 14 years ago

I was curious to why this patch is needed, I think I've found an explanation in this link: http://clang.llvm.org/compatibility.html#c++

comment:10 by tqh, 14 years ago

Had to read up on why you want typename in last case, but to me patch looks mostly ok. I'm not sure why you add iostream, can't see its use. Is it just to avoid the namespace warning?

in reply to:  10 comment:11 by kaliber, 14 years ago

Replying to tqh:

I'm not sure why you add iostream, can't see its use. Is it just to avoid the namespace warning?

Yes.

comment:12 by tqh, 14 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev37550, although the iostream include was skipped. I can't really see the use of iostream except for declaring a std namespace. Correct me if I'm wrong.

Note: See TracTickets for help on using tickets.