[haiku-commits] haiku: hrev52635 - headers/private/kernel/util src/add-ons/kernel/drivers/ports/pc_serial src/add-ons/kernel/busses/usb src/add-ons/kernel/network/stack src/system/kernel/locks

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 10 Dec 2018 20:24:17 -0500 (EST)

hrev52635 adds 3 changesets to branch 'master'
old head: b279d6def1fe5e1afef5c966d2e8dbd13747e7d7
new head: 08858e10fa4a01ea85d44c76ff7848db5a95c084
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=08858e10fa4a+%5Eb279d6def1fe

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

8844a67e90d5: More trivial syntax and logic cleanup.
  
  Spotted by Clang. No functional change intended.

cac9cf156586: kernel: Staticize id_generator's GeneratorList object.
  
  Spotted by Clang.

08858e10fa4a: kernel_cpp: Don't import all of the "std" namespace.
  
  This file is included, directly or indirectly, by most of the
  kernel-space C++ code, and so importing the entirety of "std"
  seriously pollutes the global namespace.
  
  So instead, just import "std::nothrow", which is the only thing
  we really want in the global namespace. Tested on both GCC2
  and GCC7 and seems to work just fine.
  
  While I'm here, also update the include guards and copyright
  header to match the standard format used elsewhere.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

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

14 files changed, 19 insertions(+), 73 deletions(-)
headers/private/kernel/util/kernel_cpp.h         | 19 ++++-----
.../bus_managers/usb/PhysicalMemoryAllocator.h   |  2 +-
src/add-ons/kernel/busses/usb/ehci.h             |  4 +-
.../kernel/drivers/ports/pc_serial/kernel_cpp.h  | 45 --------------------
src/add-ons/kernel/network/protocols/tcp/tcp.cpp |  2 -
src/add-ons/kernel/network/stack/interfaces.cpp  |  4 +-
src/add-ons/kernel/network/stack/interfaces.h    |  4 +-
src/add-ons/kernel/network/stack/routes.h        |  2 +-
src/system/kernel/cache/file_cache.cpp           |  1 -
src/system/kernel/device_manager/FileDevice.cpp  |  1 -
.../kernel/device_manager/id_generator.cpp       |  2 +-
src/system/kernel/locks/lock.cpp                 |  3 --
src/system/kernel/slab/allocator.cpp             |  1 -
src/system/kernel/vm/VMAddressSpace.cpp          |  2 +-

############################################################################

Commit:      8844a67e90d55efdfa98ed5f30ef94086786d9ea
URL:         https://git.haiku-os.org/haiku/commit/?id=8844a67e90d5
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Dec 11 00:16:19 2018 UTC

More trivial syntax and logic cleanup.

Spotted by Clang. No functional change intended.

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

diff --git a/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h 
b/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h
index e23e6c6095..053dcddcef 100644
--- a/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h
+++ b/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h
@@ -22,7 +22,7 @@ public:
                                                                                
uint32 minCountPerBlock);
                                                                        
~PhysicalMemoryAllocator();
 
-               status_t                                        InitCheck() { 
return fStatus; };
+               status_t                                        InitCheck() { 
return fStatus; }
 
                status_t                                        Allocate(size_t 
size,
                                                                                
void **logicalAddress,
diff --git a/src/add-ons/kernel/busses/usb/ehci.h 
b/src/add-ons/kernel/busses/usb/ehci.h
index 0e7aa7a80f..fc50521773 100644
--- a/src/add-ons/kernel/busses/usb/ehci.h
+++ b/src/add-ons/kernel/busses/usb/ehci.h
@@ -76,7 +76,7 @@ virtual       status_t                                        
NotifyPipeChange(Pipe *pipe,
 static status_t                                        AddTo(Stack *stack);
 
                // Port operations for root hub
-               uint8                                           PortCount() { 
return fPortCount; };
+               uint8                                           PortCount() { 
return fPortCount; }
                status_t                                        
GetPortStatus(uint8 index, usb_port_status *status);
                status_t                                        
SetPortFeature(uint8 index, uint16 feature);
                status_t                                        
ClearPortFeature(uint8 index, uint16 feature);
@@ -84,7 +84,7 @@ static        status_t                                        
AddTo(Stack *stack);
                status_t                                        ResetPort(uint8 
index);
                status_t                                        
SuspendPort(uint8 index);
 
-virtual        const char *                            TypeName() const { 
return "ehci"; };
+virtual        const char *                            TypeName() const { 
return "ehci"; }
 
 private:
                // Controller resets
diff --git a/src/add-ons/kernel/network/protocols/tcp/tcp.cpp 
b/src/add-ons/kernel/network/protocols/tcp/tcp.cpp
index b14f662574..69e1d73971 100644
--- a/src/add-ons/kernel/network/protocols/tcp/tcp.cpp
+++ b/src/add-ons/kernel/network/protocols/tcp/tcp.cpp
@@ -34,10 +34,8 @@
 //#define TRACE_TCP
 #ifdef TRACE_TCP
 #      define TRACE(x) dprintf x
-#      define TRACE_BLOCK(x) dump_block x
 #else
 #      define TRACE(x)
-#      define TRACE_BLOCK(x)
 #endif
 
 
diff --git a/src/add-ons/kernel/network/stack/interfaces.cpp 
b/src/add-ons/kernel/network/stack/interfaces.cpp
index b710d29575..62268c9154 100644
--- a/src/add-ons/kernel/network/stack/interfaces.cpp
+++ b/src/add-ons/kernel/network/stack/interfaces.cpp
@@ -1188,7 +1188,7 @@ Interface::_ChangeAddress(RecursiveLocker& locker, 
InterfaceAddress* address,
 /*!    Searches for a specific interface by name.
        You need to have the interface list's lock hold when calling this 
function.
 */
-static struct Interface*
+static Interface*
 find_interface(const char* name)
 {
        ASSERT_LOCKED_RECURSIVE(&sLock);
@@ -1206,7 +1206,7 @@ find_interface(const char* name)
 /*!    Searches for a specific interface by index.
        You need to have the interface list's lock hold when calling this 
function.
 */
-static struct Interface*
+static Interface*
 find_interface(uint32 index)
 {
        InterfaceList::Iterator iterator = sInterfaces.GetIterator();
diff --git a/src/add-ons/kernel/network/stack/interfaces.h 
b/src/add-ons/kernel/network/stack/interfaces.h
index 9c0cb63e27..536ab34d94 100644
--- a/src/add-ons/kernel/network/stack/interfaces.h
+++ b/src/add-ons/kernel/network/stack/interfaces.h
@@ -152,8 +152,8 @@ public:
                        domain_datalink*        DomainDatalink(net_domain* 
domain)
                                                                        { 
return DomainDatalink(domain->family); }
 
-       inline  void                            SetBusy(bool busy) { 
atomic_set(&fBusy, busy ? 1 : 0); };
-       inline  bool                            IsBusy() const { return 
atomic_get((int32*)&fBusy) == 1 ;};
+       inline  void                            SetBusy(bool busy) { 
atomic_set(&fBusy, busy ? 1 : 0); }
+       inline  bool                            IsBusy() const { return 
atomic_get((int32*)&fBusy) == 1 ; }
 
 #if ENABLE_DEBUGGER_COMMANDS
                        void                            Dump() const;
diff --git a/src/add-ons/kernel/network/stack/routes.h 
b/src/add-ons/kernel/network/stack/routes.h
index 90d2dea083..dd8eee0f96 100644
--- a/src/add-ons/kernel/network/stack/routes.h
+++ b/src/add-ons/kernel/network/stack/routes.h
@@ -15,7 +15,7 @@
 #include <util/DoublyLinkedList.h>
 
 
-class InterfaceAddress;
+struct InterfaceAddress;
 
 
 struct net_route_private
diff --git a/src/system/kernel/cache/file_cache.cpp 
b/src/system/kernel/cache/file_cache.cpp
index 80f5d4174a..64f81a8f91 100644
--- a/src/system/kernel/cache/file_cache.cpp
+++ b/src/system/kernel/cache/file_cache.cpp
@@ -37,7 +37,6 @@
 
 // maximum number of iovecs per request
 #define MAX_IO_VECS                    32      // 128 kB
-#define MAX_FILE_IO_VECS       32
 
 #define BYPASS_IO_SIZE         65536
 #define LAST_ACCESSES          3
diff --git a/src/system/kernel/device_manager/FileDevice.cpp 
b/src/system/kernel/device_manager/FileDevice.cpp
index e6b23491dd..644afbadf0 100644
--- a/src/system/kernel/device_manager/FileDevice.cpp
+++ b/src/system/kernel/device_manager/FileDevice.cpp
@@ -288,7 +288,6 @@ FileDevice::Control(void* _cookie, int32 op, void* buffer, 
size_t length)
                case B_GET_ICON_NAME:
                        return user_strlcpy((char *)buffer, 
"devices/device-volume",
                                B_FILE_NAME_LENGTH);
-                       break;
 
                case B_GET_VECTOR_ICON:
                {
diff --git a/src/system/kernel/locks/lock.cpp b/src/system/kernel/locks/lock.cpp
index f8381a9aa7..6573e03f0a 100644
--- a/src/system/kernel/locks/lock.cpp
+++ b/src/system/kernel/locks/lock.cpp
@@ -40,11 +40,8 @@ struct rw_lock_waiter {
        bool                    writer;
 };
 
-#define MUTEX_FLAG_OWNS_NAME   MUTEX_FLAG_CLONE_NAME
 #define MUTEX_FLAG_RELEASED            0x2
 
-#define RW_LOCK_FLAG_OWNS_NAME RW_LOCK_FLAG_CLONE_NAME
-
 
 int32
 recursive_lock_get_recursion(recursive_lock *lock)
diff --git a/src/system/kernel/slab/allocator.cpp 
b/src/system/kernel/slab/allocator.cpp
index ec8bef5e59..97460b3ce1 100644
--- a/src/system/kernel/slab/allocator.cpp
+++ b/src/system/kernel/slab/allocator.cpp
@@ -23,7 +23,6 @@
 #include "MemoryManager.h"
 
 
-#define DEBUG_ALLOCATOR
 //#define TEST_ALL_CACHES_DURING_BOOT
 
 static const size_t kBlockSizes[] = {
diff --git a/src/system/kernel/vm/VMAddressSpace.cpp 
b/src/system/kernel/vm/VMAddressSpace.cpp
index 7c58a05e56..bc5c82747a 100644
--- a/src/system/kernel/vm/VMAddressSpace.cpp
+++ b/src/system/kernel/vm/VMAddressSpace.cpp
@@ -341,8 +341,8 @@ VMAddressSpace::_DumpCommand(int argc, char** argv)
                } else {
                        aspace->Dump();
                }
-               return 0;
        }
+
        return 0;
 }
 

############################################################################

Commit:      cac9cf1565867b40909ece56f9c059107b360868
URL:         https://git.haiku-os.org/haiku/commit/?id=cac9cf156586
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Dec 11 00:17:08 2018 UTC

kernel: Staticize id_generator's GeneratorList object.

Spotted by Clang.

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

diff --git a/src/system/kernel/device_manager/id_generator.cpp 
b/src/system/kernel/device_manager/id_generator.cpp
index 29904a7fb7..dcb5bd75ed 100644
--- a/src/system/kernel/device_manager/id_generator.cpp
+++ b/src/system/kernel/device_manager/id_generator.cpp
@@ -66,7 +66,7 @@ struct id_generator : DoublyLinkedListLinkImpl<id_generator> {
 typedef DoublyLinkedList<id_generator> GeneratorList;
 
 
-GeneratorList sGenerators;
+static GeneratorList sGenerators;
 static mutex sLock = MUTEX_INITIALIZER("id generator");
 
 

############################################################################

Revision:    hrev52635
Commit:      08858e10fa4a01ea85d44c76ff7848db5a95c084
URL:         https://git.haiku-os.org/haiku/commit/?id=08858e10fa4a
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Dec 11 00:44:07 2018 UTC

kernel_cpp: Don't import all of the "std" namespace.

This file is included, directly or indirectly, by most of the
kernel-space C++ code, and so importing the entirety of "std"
seriously pollutes the global namespace.

So instead, just import "std::nothrow", which is the only thing
we really want in the global namespace. Tested on both GCC2
and GCC7 and seems to work just fine.

While I'm here, also update the include guards and copyright
header to match the standard format used elsewhere.

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

diff --git a/headers/private/kernel/util/kernel_cpp.h 
b/headers/private/kernel/util/kernel_cpp.h
index 4709db51a4..39416a4ff7 100644
--- a/headers/private/kernel/util/kernel_cpp.h
+++ b/headers/private/kernel/util/kernel_cpp.h
@@ -1,10 +1,10 @@
-#ifndef KERNEL_CPP_H
-#define KERNEL_CPP_H
-/* cpp - C++ in the kernel
-**
-** Initial version by Axel Dörfler, axeld@xxxxxxxxxxxxxxxx
-** This file may be used under the terms of the MIT License.
-*/
+/*
+ * Copyright 2003-2004, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx.
+ * Copyright 2004-2018, Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _KERNEL_UTIL_KERNEL_CPP_H
+#define _KERNEL_UTIL_KERNEL_CPP_H
 
 #ifdef __cplusplus
 
@@ -13,8 +13,7 @@
 
 #if _KERNEL_MODE || _LOADER_MODE
 
-using namespace std;
-extern const nothrow_t std::nothrow;
+using std::nothrow;
 
 // We need new() versions we can use when also linking against libgcc.
 // std::nothrow can't be used since it's defined in both libgcc and
@@ -47,4 +46,4 @@ extern void operator delete[](void* ptr, std::size_t) 
_NOEXCEPT;
 
 #endif // __cplusplus
 
-#endif /* KERNEL_CPP_H */
+#endif /* _KERNEL_UTIL_KERNEL_CPP_H */
diff --git a/src/add-ons/kernel/drivers/ports/pc_serial/kernel_cpp.h 
b/src/add-ons/kernel/drivers/ports/pc_serial/kernel_cpp.h
deleted file mode 100644
index 7d7b025872..0000000000
--- a/src/add-ons/kernel/drivers/ports/pc_serial/kernel_cpp.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef _KERNEL_CPP_H_
-#define _KERNEL_CPP_H_
-
-#include <malloc.h>
-
-inline void *
-operator new(size_t size)
-{
-       return malloc(size);
-}
-
-
-inline void *
-operator new[](size_t size)
-{
-       return malloc(size);
-}
-
-
-inline void
-operator delete(void *pointer)
-{
-       free(pointer);
-}
-
-
-inline void
-operator delete[](void *pointer)
-{
-       free(pointer);
-}
-
-
-inline void
-terminate(void)
-{
-}
-
-
-static inline void
-__throw()
-{
-}
-
-#endif // _KERNEL_CPP_H_


Other related posts:

  • » [haiku-commits] haiku: hrev52635 - headers/private/kernel/util src/add-ons/kernel/drivers/ports/pc_serial src/add-ons/kernel/busses/usb src/add-ons/kernel/network/stack src/system/kernel/locks - waddlesplash