[haiku-commits] BRANCH midar-github.master - src/system/libroot/posix/glibc/stdio-common headers/libs/agg src/servers/app src/system/libroot/posix/glibc src/apps

  • From: midar-github.master <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 29 Jan 2013 03:45:44 +0100 (CET)

added 1 changeset to branch 'refs/remotes/midar-github/master'
old head: e14356e39d206406b766dd28aedb58e8c546450a
new head: 75c54cdac7fcf30377c5b35abc69ab946524db21
overview: https://github.com/Midar/haiku/compare/e14356e...75c54cd

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

75c54cd: Port the whole userland to Clang.
  
  This includes libraries, apps, kits, servers and add-ons. The only thing
  missing is the kernel and kernel add-ons.
  
  Instructions to build the Haiku userland with Clang:
  
   * Configure Haiku to build with gcc4.
   * Build the kernel, kernel add-ons and loader.
     (It might be easier to just build everything with gcc4 once and then
      delete the userland from generated/objects)
   * Locate i586-haiku-gcc in your toolchain. Put a symlink in the same
     directory called i586-haiku-clang, pointing to your host's Clang. You
     do not need to build Clang as a cross-compiler, as it is always a
     cross-compiler! If you get errors later on, try compiling Clang from
     trunk.
   * Edit generated/build/BuildConfig, replace i586-haiku-gcc with
     i586-haiku-clang.
   * Edit build/jam/BuildSetup. Look for HAIKU_WERRORFLAGS, there's a
     comment which flags to use for Clang. Uncomment it and comment out
     the flags in the line above.
   * Build Haiku the same way you would do with GCC4.
  
  Known issues:
  
   * A few servers tend to crash on shutdown, as it seems gcc did not
     generate global dtors, which Clang does.

                                     [ Jonathan Schleifer <js@xxxxxxxxxxx> ]

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

Commit:      75c54cdac7fcf30377c5b35abc69ab946524db21
Author:      Jonathan Schleifer <js@xxxxxxxxxxx>
Date:        Tue Jan 29 02:22:50 2013 UTC

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

36 files changed, 151 insertions(+), 61 deletions(-)
build/jam/BuildSetup                             |  2 ++
headers/libs/agg/agg_renderer_outline_aa.h       |  2 +-
headers/libs/agg/agg_scanline_u.h                | 19 +++++++----
headers/libs/alm/ALMLayout.h                     |  5 ++-
headers/private/app/LooperList.h                 |  3 +-
.../media/media-add-ons/mixer/MixerCore.cpp      |  6 ++--
src/add-ons/screen_savers/message/Message.cpp    |  8 ++---
src/apps/fontdemo/FontDemoView.cpp               |  5 +--
src/apps/icon-o-matic/shape/PathManipulator.cpp  |  3 +-
src/apps/soundrecorder/VUView.cpp                |  3 +-
src/apps/terminal/BasicTerminalBuffer.cpp        |  3 +-
src/apps/webpositive/support/HashMap.h           |  4 +--
src/apps/webpositive/support/OpenHashTable.h     |  2 +-
src/bin/compress/compress.c                      | 10 ++++--
src/bin/network/netcat/netcat.c                  |  6 ++++
src/kits/app/ServerLink.cpp                      |  5 +--
src/kits/support/ArchivingManagers.cpp           |  4 ++-
src/kits/tracker/ViewState.cpp                   |  5 +--
src/preferences/bluetooth/DeviceListItem.h       |  4 +--
src/preferences/bluetooth/InquiryPanel.h         | 15 ++++++---
src/servers/app/ServerApp.cpp                    | 15 ++++-----
src/servers/app/drawing/DrawingEngine.cpp        |  5 ++-
src/system/libroot/posix/arch/x86/fenv.c         |  7 ++--
.../libroot/posix/glibc/arch/generic/w_dremf.c   |  3 +-
src/system/libroot/posix/glibc/arch/x86/Jamfile  |  3 ++
src/system/libroot/posix/glibc/ctype/Jamfile     |  4 +++
.../libroot/posix/glibc/extensions/Jamfile       |  4 +++
src/system/libroot/posix/glibc/iconv/Jamfile     |  3 ++
src/system/libroot/posix/glibc/libio/Jamfile     |  3 ++
src/system/libroot/posix/glibc/libio/getc_u.c    |  1 -
src/system/libroot/posix/glibc/misc/Jamfile      |  3 ++
.../libroot/posix/glibc/stdio-common/Jamfile     |  3 ++
.../libroot/posix/glibc/stdio-common/getline.c   |  4 ++-
.../libroot/posix/glibc/stdio-common/printf_fp.c | 34 ++++++++++++++++----
src/system/libroot/posix/glibc/stdlib/Jamfile    |  3 ++
src/system/libroot/posix/glibc/wcsmbs/Jamfile    |  3 ++

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

diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup
index fe3340f..adffda0 100644
--- a/build/jam/BuildSetup
+++ b/build/jam/BuildSetup
@@ -1254,6 +1254,8 @@ if $(HAIKU_GCC_VERSION[1]) >= 4 {
        if $(HAIKU_GCC_VERSION[2]) >= 6 {
                # TODO: remove the -Wno-unused-but-set-variable option
                HAIKU_WERRORFLAGS += -Wno-unused-but-set-variable ;
+               # For Clang, use these:
+               #HAIKU_WERRORFLAGS += -Wno-cast-align -Wno-mismatched-tags 
-Wno-unused-private-field -Wno-format-security -Wno-parentheses -Wno-empty-body 
-Wno-gnu -Wno-non-literal-null-conversion -Wno-return-type-c-linkage 
-Wno-tautological-compare -Wno-unused-variable -Wno-unused-volatile-lvalue 
-Wno-self-assign -Wno-constant-logical-operand -Wno-return-type ;
        }
 }
 
diff --git a/headers/libs/agg/agg_renderer_outline_aa.h 
b/headers/libs/agg/agg_renderer_outline_aa.h
index e3629db..f9c7674 100644
--- a/headers/libs/agg/agg_renderer_outline_aa.h
+++ b/headers/libs/agg/agg_renderer_outline_aa.h
@@ -1365,7 +1365,7 @@ namespace agg
         //---------------------------------------------------------------------
         void profile(const line_profile_aa& prof) { m_profile = &prof; }
         const line_profile_aa& profile() const { return *m_profile; }
-        line_profile_aa& profile() { return *m_profile; }
+        line_profile_aa& profile() { return *(line_profile_aa*)m_profile; }
 
         //---------------------------------------------------------------------
         int subpixel_width() const { return m_profile->subpixel_width(); }
diff --git a/headers/libs/agg/agg_scanline_u.h 
b/headers/libs/agg/agg_scanline_u.h
index 5a28ed1..b87e81c 100755
--- a/headers/libs/agg/agg_scanline_u.h
+++ b/headers/libs/agg/agg_scanline_u.h
@@ -464,21 +464,28 @@ namespace agg
         typedef base_type::coord_type coord_type;
 
 
-        scanline32_u8_am() : base_type(), m_alpha_mask(0) {}
-        scanline32_u8_am(const AlphaMask& am) : base_type(), m_alpha_mask(&am) 
{}
+        scanline32_u8_am() : m_alpha_mask(0)
+               {
+                       this->base_type();
+               }
+
+        scanline32_u8_am(const AlphaMask& am) : m_alpha_mask(&am)
+               {
+                       this->base_type();
+               }
 
         //--------------------------------------------------------------------
         void finalize(int span_y)
         {
-            base_type::finalize(span_y);
+            this->base_type::finalize(span_y);
             if(m_alpha_mask)
             {
-                typename base_type::iterator span = base_type::begin();
-                unsigned count = base_type::num_spans();
+                typename base_type::iterator span = this->base_type::begin();
+                unsigned count = this->base_type::num_spans();
                 do
                 {
                     m_alpha_mask->combine_hspan(span->x, 
-                                                base_type::y(), 
+                                                this->base_type::y(),
                                                 span->covers, 
                                                 span->len);
                     ++span;
diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h
index 98522b8..cc01a91 100644
--- a/headers/libs/alm/ALMLayout.h
+++ b/headers/libs/alm/ALMLayout.h
@@ -16,7 +16,10 @@
 
 class BView;
 class BLayoutItem;
-class Constraint;
+
+namespace LinearProgramming {
+       class Constraint;
+}
 
 
 namespace BPrivate {
diff --git a/headers/private/app/LooperList.h b/headers/private/app/LooperList.h
index 7bdc824..b2ed2ba 100644
--- a/headers/private/app/LooperList.h
+++ b/headers/private/app/LooperList.h
@@ -43,7 +43,6 @@ public:
 
                        void                            InitAfterFork();
 
-private:
        struct LooperData {
                LooperData();
                LooperData(BLooper* looper);
@@ -52,6 +51,8 @@ private:
 
                BLooper*        looper;
        };
+
+private:
        struct FindLooperPred {
                FindLooperPred(const BLooper* loop) : looper(loop) {}
                bool operator()(LooperData& Data);
diff --git a/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp 
b/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp
index 3ff2a8f..3b67798 100644
--- a/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp
+++ b/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp
@@ -16,6 +16,7 @@
 #include <BufferProducer.h>
 #include <MediaNode.h>
 #include <RealtimeAlloc.h>
+#include <StackOrHeapArray.h>
 #include <StopWatch.h>
 #include <TimeSource.h>
 
@@ -520,8 +521,9 @@ MixerCore::_MixThread()
        uint64 bufferIndex = 0;
 #endif
 
-       RtList<chan_info> inputChanInfos[MAX_CHANNEL_TYPES];
-       RtList<chan_info> mixChanInfos[fMixBufferChannelCount];
+       typedef RtList<chan_info> chan_info_list;
+       chan_info_list inputChanInfos[MAX_CHANNEL_TYPES];
+       BStackOrHeapArray<chan_info_list, 16> 
mixChanInfos(fMixBufferChannelCount);
                // TODO: this does not support changing output channel count
 
        bigtime_t eventTime = timeBase;
diff --git a/src/add-ons/screen_savers/message/Message.cpp 
b/src/add-ons/screen_savers/message/Message.cpp
index f45643d..96fad92 100644
--- a/src/add-ons/screen_savers/message/Message.cpp
+++ b/src/add-ons/screen_savers/message/Message.cpp
@@ -100,9 +100,9 @@ class Message : public BScreenSaver
                status_t        StartSaver(BView *view, bool preview);
                
        private:
-               BObjectList<font_family>        fFontFamilies;
-               float                                           fScaleFactor;
-               bool                                            fPreview;
+               BObjectList<char*>      fFontFamilies;
+               float                           fScaleFactor;
+               bool                            fPreview;
 };
 
 
@@ -151,7 +151,7 @@ Message::StartSaver(BView *view, bool preview)
                if (get_font_family(i, family, &flags) == B_OK) {
                        // Do not add fixed fonts
                        if (!(flags & B_IS_FIXED))
-                               fFontFamilies.AddItem(family);
+                               fFontFamilies.AddItem((char**)&(family[0]));
                }
        }
 
diff --git a/src/apps/fontdemo/FontDemoView.cpp 
b/src/apps/fontdemo/FontDemoView.cpp
index af4205e..ec1ab54 100644
--- a/src/apps/fontdemo/FontDemoView.cpp
+++ b/src/apps/fontdemo/FontDemoView.cpp
@@ -20,6 +20,7 @@
 #include <Message.h>
 #include <Shape.h>
 #include <String.h>
+#include <StackOrHeapArray.h>
 
 #include "messages.h"
 
@@ -99,7 +100,7 @@ FontDemoView::_DrawView(BView* view)
        view->SetFont(&fFont, B_FONT_ALL);
 
        const size_t size = fString.CountChars();
-       BRect boundBoxes[size];
+       BStackOrHeapArray<BRect, 64> boundBoxes(size);
 
        if (OutLineLevel())
                fFont.GetGlyphShapes(fString, size, fShapes);
@@ -456,4 +457,4 @@ FontDemoView::_NewBitmap(BRect rect)
                delete fBitmap;
                fBitmap = NULL;
        }
-}
\ No newline at end of file
+}
diff --git a/src/apps/icon-o-matic/shape/PathManipulator.cpp 
b/src/apps/icon-o-matic/shape/PathManipulator.cpp
index 4a06a51..81f3f75 100644
--- a/src/apps/icon-o-matic/shape/PathManipulator.cpp
+++ b/src/apps/icon-o-matic/shape/PathManipulator.cpp
@@ -14,6 +14,7 @@
 #include <Message.h>
 #include <MenuItem.h>
 #include <PopUpMenu.h>
+#include <StackOrHeapArray.h>
 #include <Window.h>
 
 #include "cursors.h"
@@ -1703,7 +1704,7 @@ PathManipulator::_Nudge(BPoint direction)
                int32 count = fromSelection ? fSelection->CountItems()
                                                                        : 
fPath->CountPoints();
                int32 indices[count];
-               control_point points[count];
+               BStackOrHeapArray<control_point, 64> points(count);
 
                // init indices and points
                for (int32 i = 0; i < count; i++) {
diff --git a/src/apps/soundrecorder/VUView.cpp 
b/src/apps/soundrecorder/VUView.cpp
index c90afc5..2f6112b 100644
--- a/src/apps/soundrecorder/VUView.cpp
+++ b/src/apps/soundrecorder/VUView.cpp
@@ -11,6 +11,7 @@
 
 #include <MediaDefs.h>
 #include <Screen.h>
+#include <StackOrHeapArray.h>
 #include <Window.h>
 
 #include "DrawingTidbits.h"
@@ -108,7 +109,7 @@ VUView::_RenderLaunch(void *data)
 void
 VUView::_RenderLoop()
 {
-       rgb_color levels[fLevelCount][2];
+       BStackOrHeapArray<rgb_color[2], 64> levels(fLevelCount);
        
        for (int32 i = 0; i < fLevelCount; i++) {
                levels[i][0] = levels[i][1] = back_color;       
diff --git a/src/apps/terminal/BasicTerminalBuffer.cpp 
b/src/apps/terminal/BasicTerminalBuffer.cpp
index 5658216..0cedd20 100644
--- a/src/apps/terminal/BasicTerminalBuffer.cpp
+++ b/src/apps/terminal/BasicTerminalBuffer.cpp
@@ -11,6 +11,7 @@
 
 #include <algorithm>
 
+#include <StackOrHeapArray.h>
 #include <String.h>
 
 #include "TermConst.h"
@@ -491,7 +492,7 @@ BasicTerminalBuffer::Find(const char* _pattern, const 
TermPos& start,
        int32 patternByteLen = strlen(_pattern);
 
        // convert pattern to UTF8Char array
-       UTF8Char pattern[patternByteLen];
+       BStackOrHeapArray<UTF8Char, 64> pattern(patternByteLen);
        int32 patternLen = 0;
        while (*_pattern != '\0') {
                int32 charLen = UTF8Char::ByteCount(*_pattern);
diff --git a/src/apps/webpositive/support/HashMap.h 
b/src/apps/webpositive/support/HashMap.h
index 36b321f..05a0096 100644
--- a/src/apps/webpositive/support/HashMap.h
+++ b/src/apps/webpositive/support/HashMap.h
@@ -458,10 +458,10 @@ HashMap<Key, Value>::GetIterator() const
 
 // _FindElement
 template<typename Key, typename Value>
-struct HashMap<Key, Value>::Element *
+HashMapElement<Key, Value> *
 HashMap<Key, Value>::_FindElement(const Key& key) const
 {
-       Element* element = fTable.FindFirst(key.GetHashCode());
+       HashMapElement<Key, Value>* element = 
fTable.FindFirst(key.GetHashCode());
        while (element && element->fKey != key) {
                if (element->fNext >= 0)
                        element = fTable.ElementAt(element->fNext);
diff --git a/src/apps/webpositive/support/OpenHashTable.h 
b/src/apps/webpositive/support/OpenHashTable.h
index 437fbed..d66ad66 100644
--- a/src/apps/webpositive/support/OpenHashTable.h
+++ b/src/apps/webpositive/support/OpenHashTable.h
@@ -447,7 +447,7 @@ OpenHashElementArray<Element>::Add(const Element 
&newElement)
 {
        Element *element = Add();
        if (element)
-               element.Adopt(newElement);
+               element->Adopt(newElement);
        return element;
 }
 
diff --git a/src/bin/compress/compress.c b/src/bin/compress/compress.c
index 7c6da280..b68283c 100644
--- a/src/bin/compress/compress.c
+++ b/src/bin/compress/compress.c
@@ -494,6 +494,10 @@ void (*bgnd_flag)();
 
 int do_decomp = 0;
 
+void compress(void);
+void decompress(void);
+void copystat(char *ifname, char *ofname);
+
 /*****************************************************************
  * TAG( main )
  *
@@ -947,6 +951,7 @@ long int out_count = 0;                     /* # of codes 
output (for debugging) */
  * questions about this implementation to ames!jaw.
  */
 
+void
 compress() {
     register long fcode;
     register code_int i = 0;
@@ -1215,6 +1220,7 @@ code_int  code;
  * with those of the compress() routine.  See the definitions above.
  */
 
+void
 decompress() {
 
 #ifdef BIG
@@ -1515,8 +1521,8 @@ writeerr()
     exit ( 1 );
 }
 
-copystat(ifname, ofname)
-char *ifname, *ofname;
+void
+copystat(char *ifname, char *ofname)
 {
     struct stat statbuf;
     int mode;
diff --git a/src/bin/network/netcat/netcat.c b/src/bin/network/netcat/netcat.c
index e46fad2..8de7ecc 100644
--- a/src/bin/network/netcat/netcat.c
+++ b/src/bin/network/netcat/netcat.c
@@ -175,6 +175,11 @@ USHORT o_zero = 0;
 /* support routines -- the bulk of this thing.  Placed in such an order that
    we don't have to forward-declare anything: */
 
+#ifdef HAVE_HELP
+void helpme();
+#endif
+
+
 /* holler :
    fake varargs -- need to do this way because we wind up calling through
    more levels of indirection than vanilla varargs can handle, and not all
@@ -1312,6 +1317,7 @@ Debug (("wrote %d to net, errno %d", rr, errno))
   return (0);
 } /* readwrite */
 
+
 /* main :
    now we pull it all together... */
 main (argc, argv)
diff --git a/src/kits/app/ServerLink.cpp b/src/kits/app/ServerLink.cpp
index ea7664a..05ac105 100644
--- a/src/kits/app/ServerLink.cpp
+++ b/src/kits/app/ServerLink.cpp
@@ -25,6 +25,7 @@
 #include <GradientConic.h>
 #include <Region.h>
 #include <Shape.h>
+#include <StackOrHeapArray.h>
 
 #include <ServerProtocol.h>
 
@@ -96,11 +97,11 @@ ServerLink::ReadShape(BShape* shape)
        fReceiver->Read(&opCount, sizeof(int32));
        fReceiver->Read(&ptCount, sizeof(int32));
 
-       uint32 opList[opCount];
+       BStackOrHeapArray<uint32, 64> opList(opCount);
        if (opCount > 0)
                fReceiver->Read(opList, opCount * sizeof(uint32));
 
-       BPoint ptList[ptCount];
+       BStackOrHeapArray<BPoint, 64> ptList(ptCount);
        if (ptCount > 0)
                fReceiver->Read(ptList, ptCount * sizeof(BPoint));
 
diff --git a/src/kits/support/ArchivingManagers.cpp 
b/src/kits/support/ArchivingManagers.cpp
index 3405b53..069b339 100644
--- a/src/kits/support/ArchivingManagers.cpp
+++ b/src/kits/support/ArchivingManagers.cpp
@@ -11,6 +11,8 @@
 #include <syslog.h>
 #include <typeinfo>
 
+#include <StackOrHeapArray.h>
+
 
 namespace BPrivate {
 namespace Archiving {
@@ -163,7 +165,7 @@ BArchiveManager::ArchiverLeaving(const BArchiver* archiver, 
status_t err)
        if (archiver == fCreator && fError == B_OK) {
                // first, we must sort the objects into the order they were 
archived in
                typedef std::pair<BMessage*, const BArchivable*> ArchivePair;
-               ArchivePair pairs[fTokenMap.size()];
+               BStackOrHeapArray<ArchivePair, 64> pairs(fTokenMap.size());
 
                for(TokenMap::iterator it = fTokenMap.begin(), end = 
fTokenMap.end();
                                it != end; it++) {
diff --git a/src/kits/tracker/ViewState.cpp b/src/kits/tracker/ViewState.cpp
index 831ccf4..297d7ed 100644
--- a/src/kits/tracker/ViewState.cpp
+++ b/src/kits/tracker/ViewState.cpp
@@ -43,10 +43,11 @@ All rights reserved.
 #include "Utilities.h"
 #include "ViewState.h"
 
-#include <new>
+#include <assert.h>
 #include <string.h>
 #include <stdlib.h>
 
+#include <new>
 
 const char* kColumnVersionName = "BColumn:version";
 const char* kColumnTitleName = "BColumn:fTitle";
@@ -119,7 +120,7 @@ BColumn::BColumn(BMallocIO* stream, int32 version, bool 
endianSwap)
                PRINT(("endian swapping column\n"));
                fOffset = B_SWAP_FLOAT(fOffset);
                fWidth = B_SWAP_FLOAT(fWidth);
-               STATIC_ASSERT(sizeof(BColumn::fAlignment) == sizeof(int32));
+               assert(sizeof(BColumn::fAlignment) == sizeof(int32));
                fAlignment = (alignment)B_SWAP_INT32(fAlignment);
                fAttrHash = B_SWAP_INT32(fAttrHash);
                fAttrType = B_SWAP_INT32(fAttrType);
diff --git a/src/preferences/bluetooth/DeviceListItem.h 
b/src/preferences/bluetooth/DeviceListItem.h
index 5f72fd3..e087913 100644
--- a/src/preferences/bluetooth/DeviceListItem.h
+++ b/src/preferences/bluetooth/DeviceListItem.h
@@ -11,10 +11,10 @@
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/DeviceClass.h>
 
-class BluetoothDevice;
-
 namespace Bluetooth {
 
+class BluetoothDevice;
+
 class DeviceListItem : public BListItem
 {
        public:
diff --git a/src/preferences/bluetooth/InquiryPanel.h 
b/src/preferences/bluetooth/InquiryPanel.h
index 3e6c760..0c5d4e1 100644
--- a/src/preferences/bluetooth/InquiryPanel.h
+++ b/src/preferences/bluetooth/InquiryPanel.h
@@ -16,11 +16,18 @@ class BButton;
 class BTextView;
 class BListView;
 class BScrollView;
-class LocalDevice;
-class DiscoveryAgent;
-class DiscoveryListener;
 
-class InquiryPanel : public BWindow 
+namespace Bluetooth {
+       class LocalDevice;
+       class DiscoveryAgent;
+       class DiscoveryListener;
+}
+
+using Bluetooth::LocalDevice;
+using Bluetooth::DiscoveryAgent;
+using Bluetooth::DiscoveryListener;
+
+class InquiryPanel : public BWindow
 {
 public:
                        InquiryPanel(BRect frame, LocalDevice* lDevice = NULL); 
diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp
index 90651ea..953e5a9 100644
--- a/src/servers/app/ServerApp.cpp
+++ b/src/servers/app/ServerApp.cpp
@@ -34,6 +34,7 @@
 #include <ScrollBar.h>
 #include <Shape.h>
 #include <String.h>
+#include <StackOrHeapArray.h>
 
 #include <FontPrivate.h>
 #include <MessengerPrivate.h>
@@ -1855,10 +1856,9 @@ ServerApp::_DispatchMessage(int32 code, 
BPrivate::LinkReceiver& link)
                                size = 0.0f;
                        }
 
-                       // TODO: don't use the stack for this - numStrings 
could be large
-                       float widthArray[numStrings];
-                       int32 lengthArray[numStrings];
-                       char *stringArray[numStrings];
+                       BStackOrHeapArray<float, 64> widthArray(numStrings);
+                       BStackOrHeapArray<int32, 64> lengthArray(numStrings);
+                       BStackOrHeapArray<char*, 64> stringArray(numStrings);
                        for (int32 i = 0; i < numStrings; i++) {
                                // This version of ReadString allocates the 
strings, we free
                                // them below
@@ -1881,7 +1881,7 @@ ServerApp::_DispatchMessage(int32 code, 
BPrivate::LinkReceiver& link)
                                }
 
                                fLink.StartMessage(B_OK);
-                               fLink.Attach(widthArray, sizeof(widthArray));
+                               fLink.Attach(widthArray, numStrings * 
sizeof(float));
                        } else
                                fLink.StartMessage(B_BAD_VALUE);
 
@@ -2496,8 +2496,7 @@ ServerApp::_DispatchMessage(int32 code, 
BPrivate::LinkReceiver& link)
                                link.Read<escapement_delta>(&deltaArray[i]);
                        }
 
-                       // TODO: don't do this on the heap! (at least check the 
size before)
-                       BRect rectArray[numStrings];
+                       BStackOrHeapArray<BRect, 64> rectArray(numStrings);
 
                        ServerFont font;
                        bool success = false;
@@ -2512,7 +2511,7 @@ ServerApp::_DispatchMessage(int32 code, 
BPrivate::LinkReceiver& link)
                                if 
(font.GetBoundingBoxesForStrings(stringArray, lengthArray,
                                        numStrings, rectArray, mode, 
deltaArray) == B_OK) {
                                        fLink.StartMessage(B_OK);
-                                       fLink.Attach(rectArray, 
sizeof(rectArray));
+                                       fLink.Attach(rectArray, numStrings * 
sizeof(BRect));
                                        success = true;
                                }
                        }
diff --git a/src/servers/app/drawing/DrawingEngine.cpp 
b/src/servers/app/drawing/DrawingEngine.cpp
index 4ec70d7..6ef0b85 100644
--- a/src/servers/app/drawing/DrawingEngine.cpp
+++ b/src/servers/app/drawing/DrawingEngine.cpp
@@ -10,7 +10,10 @@
 #include "DrawingEngine.h"
 
 #include <Bitmap.h>
+#include <StackOrHeapArray.h>
+
 #include <stdio.h>
+
 #include <algorithm>
 #include <stack>
 
@@ -469,7 +472,7 @@ DrawingEngine::CopyRegion(/*const*/ BRegion* region, int32 
xOffset,
 
        // TODO: make this step unnecessary
        // (by using different stack impl inside node)
-       node nodes[count];
+       BStackOrHeapArray<node, 64> nodes(count);
        for (int32 i= 0; i < count; i++) {
                nodes[i].init(region->RectAt(i), count);
        }
diff --git a/src/system/libroot/posix/arch/x86/fenv.c 
b/src/system/libroot/posix/arch/x86/fenv.c
index b0c657b..78b9db0 100644
--- a/src/system/libroot/posix/arch/x86/fenv.c
+++ b/src/system/libroot/posix/arch/x86/fenv.c
@@ -165,7 +165,7 @@ feupdateenv(const fenv_t *envp)
        return (0);
 }
 
-int
+int __attribute__((weak, alias("feenableexcept")))
 __feenableexcept(int mask)
 {
        int mxcsr, control, omask;
@@ -186,7 +186,7 @@ __feenableexcept(int mask)
        return (~omask);
 }
 
-int
+int __attribute__((weak, alias("fedisableexcept")))
 __fedisableexcept(int mask)
 {
        int mxcsr, control, omask;
@@ -206,6 +206,3 @@ __fedisableexcept(int mask)
        }
        return (~omask);
 }
-
-__weak_reference(__feenableexcept, feenableexcept);
-__weak_reference(__fedisableexcept, fedisableexcept);
diff --git a/src/system/libroot/posix/glibc/arch/generic/w_dremf.c 
b/src/system/libroot/posix/glibc/arch/generic/w_dremf.c
index b740ea3..34a4c4a 100644
--- a/src/system/libroot/posix/glibc/arch/generic/w_dremf.c
+++ b/src/system/libroot/posix/glibc/arch/generic/w_dremf.c
@@ -9,8 +9,7 @@
 #include "math_private.h"
 
 float
-__dremf(x, y)
-       float x, y;
+__dremf(float x, float y)
 {
        return __remainderf(x, y);
 }
diff --git a/src/system/libroot/posix/glibc/arch/x86/Jamfile 
b/src/system/libroot/posix/glibc/arch/x86/Jamfile
index 4035668..34b7834 100644
--- a/src/system/libroot/posix/glibc/arch/x86/Jamfile
+++ b/src/system/libroot/posix/glibc/arch/x86/Jamfile
@@ -20,6 +20,9 @@ if $(OPTIM) = -O0 {
 DEBUG = 0 ;
 
 SubDirCcFlags -D_GNU_SOURCE -D_IEEE_LIBM ;
+if $(HAIKU_GCC_VERSION[1]) >= 4 {
+       SubDirCcFlags -fgnu89-inline ;
+}
 
 local genericSources =
        cmp.c dbl2mpn.c divrem.c 
diff --git a/src/system/libroot/posix/glibc/ctype/Jamfile 
b/src/system/libroot/posix/glibc/ctype/Jamfile
index ff8c702..7b05f43 100644
--- a/src/system/libroot/posix/glibc/ctype/Jamfile
+++ b/src/system/libroot/posix/glibc/ctype/Jamfile
@@ -1,5 +1,9 @@
 SubDir HAIKU_TOP src system libroot posix glibc ctype ;
 
+if $(HAIKU_GCC_VERSION[1]) >= 4 {
+       SubDirCcFlags -fgnu89-inline ;
+}
+
 SubDirSysHdrs $(SUBDIR) ;
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch
        $(TARGET_ARCH) ;
diff --git a/src/system/libroot/posix/glibc/extensions/Jamfile 
b/src/system/libroot/posix/glibc/extensions/Jamfile
index 25fdbd5..ab54678 100644
--- a/src/system/libroot/posix/glibc/extensions/Jamfile
+++ b/src/system/libroot/posix/glibc/extensions/Jamfile
@@ -1,5 +1,9 @@
 SubDir HAIKU_TOP src system libroot posix glibc extensions ;
 
+if $(HAIKU_GCC_VERSION[1]) >= 4 {
+       SubDirCcFlags -fgnu89-inline ;
+}
+
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch
        $(TARGET_ARCH) ;
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch generic 
;
diff --git a/src/system/libroot/posix/glibc/iconv/Jamfile 
b/src/system/libroot/posix/glibc/iconv/Jamfile
index 94cd974..974283b 100644
--- a/src/system/libroot/posix/glibc/iconv/Jamfile
+++ b/src/system/libroot/posix/glibc/iconv/Jamfile
@@ -14,6 +14,9 @@ UsePrivateHeaders libroot ;
 
 
 SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
+if $(HAIKU_GCC_VERSION[1]) >= 4 {
+       SubDirCcFlags -fgnu89-inline ;
+}
 
 MergeObject posix_gnu_iconv.o :
        gconv_builtin.c
diff --git a/src/system/libroot/posix/glibc/libio/Jamfile 
b/src/system/libroot/posix/glibc/libio/Jamfile
index 4e6f0dc..bc3c71a 100644
--- a/src/system/libroot/posix/glibc/libio/Jamfile
+++ b/src/system/libroot/posix/glibc/libio/Jamfile
@@ -18,6 +18,9 @@ UsePrivateHeaders libroot ;
 # obstack functionality
 
 SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
+if $(HAIKU_GCC_VERSION[1]) >= 4 {
+       SubDirCcFlags -fgnu89-inline ;
+}
 
 MergeObject posix_gnu_libio.o :
        __fsetlocking.c
diff --git a/src/system/libroot/posix/glibc/libio/getc_u.c 
b/src/system/libroot/posix/glibc/libio/getc_u.c
index f0c19b4..2f0c6a2 100644
--- a/src/system/libroot/posix/glibc/libio/getc_u.c
+++ b/src/system/libroot/posix/glibc/libio/getc_u.c
@@ -26,7 +26,6 @@
    in files containing the exception.  */
 
 #include "libioP.h"
-#include <stdio.h>
 
 #undef getc_unlocked
 
diff --git a/src/system/libroot/posix/glibc/misc/Jamfile 
b/src/system/libroot/posix/glibc/misc/Jamfile
index 937e164..52189e1 100644
--- a/src/system/libroot/posix/glibc/misc/Jamfile
+++ b/src/system/libroot/posix/glibc/misc/Jamfile
@@ -14,6 +14,9 @@ UsePrivateHeaders libroot ;
 
 
 SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
+if $(HAIKU_GCC_VERSION[1]) >= 4 {
+       SubDirCcFlags -fgnu89-inline ;
+}
 
 MergeObject posix_gnu_misc.o :
        hsearch.c
diff --git a/src/system/libroot/posix/glibc/stdio-common/Jamfile 
b/src/system/libroot/posix/glibc/stdio-common/Jamfile
index bea6ede..d75419f 100644
--- a/src/system/libroot/posix/glibc/stdio-common/Jamfile
+++ b/src/system/libroot/posix/glibc/stdio-common/Jamfile
@@ -1,6 +1,9 @@
 SubDir HAIKU_TOP src system libroot posix glibc stdio-common ;
 
 SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
+if $(HAIKU_GCC_VERSION[1]) >= 4 {
+       SubDirCcFlags -fgnu89-inline ;
+}
 
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc libio ;
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch
diff --git a/src/system/libroot/posix/glibc/stdio-common/getline.c 
b/src/system/libroot/posix/glibc/stdio-common/getline.c
index 35ac492..db1d182 100644
--- a/src/system/libroot/posix/glibc/stdio-common/getline.c
+++ b/src/system/libroot/posix/glibc/stdio-common/getline.c
@@ -17,9 +17,11 @@
    02111-1307 USA.  */
 
 #include <stddef.h>
-#include <stdio.h>
+#include "_G_config.h"
 
 ssize_t __getline(char **lineptr, size_t *n, FILE *stream);
+extern ssize_t __getdelim(char **lineptr, size_t *n, int delimiter,
+       FILE *stream);
 
 /** Like getdelim, but always looks for a newline. */
 
diff --git a/src/system/libroot/posix/glibc/stdio-common/printf_fp.c 
b/src/system/libroot/posix/glibc/stdio-common/printf_fp.c
index 4c68c5e..d22c731 100644
--- a/src/system/libroot/posix/glibc/stdio-common/printf_fp.c
+++ b/src/system/libroot/posix/glibc/stdio-common/printf_fp.c
@@ -200,12 +200,14 @@ __printf_fp (FILE *fp,
   /* Nonzero if this is output on a wide character stream.  */
   int wide = info->wide;
 
-  auto wchar_t hack_digit (void);
+  wchar_t hack_digit_ret;
+  int hack_digit_callee;
 
-  wchar_t hack_digit (void)
+  while (0)
     {
       mp_limb_t hi;
 
+hack_digit:
       if (expsign != 0 && type == 'f' && exponent-- > 0)
        hi = 0;
       else if (scalesize == 0)
@@ -232,7 +234,8 @@ __printf_fp (FILE *fp,
                  /* We're not prepared for an mpn variable with zero
                     limbs.  */
                  fracsize = 1;
-                 return L'0' + hi;
+                 hack_digit_ret = L'0' + hi;
+                 goto hack_digit_end;
                }
            }
 
@@ -241,7 +244,15 @@ __printf_fp (FILE *fp,
            frac[fracsize++] = cy;
        }
 
-      return L'0' + hi;
+      hack_digit_ret = L'0' + hi;
+hack_digit_end:
+      switch (hack_digit_callee)
+        {
+         case 1: goto hack_digit_callee1;
+         case 2: goto hack_digit_callee2;
+         case 3: goto hack_digit_callee3;
+         default: abort();
+       }
     }
 
 
@@ -885,7 +896,10 @@ __printf_fp (FILE *fp,
        while (intdig_no < intdig_max)
          {
            ++intdig_no;
-           *wcp++ = hack_digit ();
+           hack_digit_callee = 1;
+           goto hack_digit;
+hack_digit_callee1:
+           *wcp++ = hack_digit_ret;
          }
        significant = 1;
        if (info->alt
@@ -907,7 +921,10 @@ __printf_fp (FILE *fp,
           || (fracdig_no < fracdig_max && (fracsize > 1 || frac[0] != 0)))
       {
        ++fracdig_no;
-       *wcp = hack_digit ();
+       hack_digit_callee = 2;
+       goto hack_digit;
+hack_digit_callee2:
+       *wcp++ = hack_digit_ret;
        if (*wcp != L'0')
          significant = 1;
        else if (significant == 0)
@@ -920,7 +937,10 @@ __printf_fp (FILE *fp,
       }
 
     /* Do rounding.  */
-    digit = hack_digit ();
+    hack_digit_callee = 3;
+    goto hack_digit;
+hack_digit_callee3:
+    digit = hack_digit_ret;
     if (digit > L'4')
       {
        wchar_t *wtp = wcp;
diff --git a/src/system/libroot/posix/glibc/stdlib/Jamfile 
b/src/system/libroot/posix/glibc/stdlib/Jamfile
index fe91aa1..22cdd31 100644
--- a/src/system/libroot/posix/glibc/stdlib/Jamfile
+++ b/src/system/libroot/posix/glibc/stdlib/Jamfile
@@ -10,6 +10,9 @@ SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
 UsePrivateHeaders libroot ;
 
 SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
+if $(HAIKU_GCC_VERSION[1]) >= 4 {
+       SubDirCcFlags -fgnu89-inline ;
+}
 
 MergeObject posix_gnu_stdlib.o :
        drand48.c
diff --git a/src/system/libroot/posix/glibc/wcsmbs/Jamfile 
b/src/system/libroot/posix/glibc/wcsmbs/Jamfile
index 66ce9e3..d2def89 100644
--- a/src/system/libroot/posix/glibc/wcsmbs/Jamfile
+++ b/src/system/libroot/posix/glibc/wcsmbs/Jamfile
@@ -16,6 +16,9 @@ UsePrivateHeaders libroot ;
 
 
 SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ;
+if $(HAIKU_GCC_VERSION[1]) >= 4 {
+       SubDirCcFlags -fgnu89-inline ;
+}
 
 MergeObject posix_gnu_wcsmbs.o :
        wcsmbsload.c


Other related posts: