* Removed -Wno-unused from all KernelMergeObjects in kernel Jamfiles.

* Fixed most of the warnings resulting from that by removing actually not used
  variables or moving declaration into the #IF. Left unused functions there
  though, as I wouldn't know if they are supposed to be used again.
* Fixed two statements with no effect (clamping to MAX_ANCILLARY_DATA_LEN in
  socket.cpp and unsetting fCounterSem in MessagingService.cpp).
* Some style cleanups.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26253 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-07-04 23:14:19 +00:00
parent 4d9151c499
commit a8f9741c8c
28 changed files with 66 additions and 113 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ KernelMergeObject kernel_arch_x86.o :
generic_vm_physical_page_mapper.cpp generic_vm_physical_page_mapper.cpp
: :
$(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused $(TARGET_KERNEL_PIC_CCFLAGS)
; ;
CreateAsmStructOffsetsHeader asm_offsets.h : asm_offsets.cpp ; CreateAsmStructOffsetsHeader asm_offsets.h : asm_offsets.cpp ;
-3
View File
@@ -159,8 +159,6 @@ x86_count_mtrrs(void)
void void
x86_set_mtrr(uint32 index, uint64 base, uint64 length, uint8 type) x86_set_mtrr(uint32 index, uint64 base, uint64 length, uint8 type)
{ {
cpu_status state;
struct set_mtrr_parameter parameter; struct set_mtrr_parameter parameter;
parameter.index = index; parameter.index = index;
parameter.base = base; parameter.base = base;
@@ -333,7 +331,6 @@ static int
detect_cpu(int curr_cpu) detect_cpu(int curr_cpu)
{ {
cpuid_info cpuid; cpuid_info cpuid;
unsigned int data[4];
char vendor_str[17]; char vendor_str[17];
int i; int i;
cpu_ent *cpu = get_cpu_struct(); cpu_ent *cpu = get_cpu_struct();
+1 -2
View File
@@ -270,7 +270,7 @@ stack_trace(int argc, char **argv)
struct thread *thread = NULL; struct thread *thread = NULL;
addr_t oldPageDirectory = 0; addr_t oldPageDirectory = 0;
uint32 ebp = x86_read_ebp(); uint32 ebp = x86_read_ebp();
int32 i, num = 0, last = 0; int32 num = 0, last = 0;
setup_for_thread(argc == 2 ? argv[1] : NULL, &thread, &ebp, setup_for_thread(argc == 2 ? argv[1] : NULL, &thread, &ebp,
&oldPageDirectory); &oldPageDirectory);
@@ -490,7 +490,6 @@ dump_iframes(int argc, char **argv)
} }
struct thread *thread = NULL; struct thread *thread = NULL;
int32 i;
if (argc < 2) { if (argc < 2) {
thread = thread_get_current_thread(); thread = thread_get_current_thread();
@@ -186,7 +186,7 @@ arch_debug_blue_screen_getchar(void)
static bool altPressed = false; static bool altPressed = false;
static uint8 special = 0; static uint8 special = 0;
static uint8 special2 = 0; static uint8 special2 = 0;
uint8 key, ascii = 0; uint8 key = 0;
if (special & 0x80) { if (special & 0x80) {
special &= ~0x80; special &= ~0x80;
@@ -310,7 +310,6 @@ status_t
arch_thread_init_tls(struct thread *thread) arch_thread_init_tls(struct thread *thread)
{ {
uint32 tls[TLS_USER_THREAD_SLOT + 1]; uint32 tls[TLS_USER_THREAD_SLOT + 1];
int32 i;
thread->user_local_storage = thread->user_stack_base thread->user_local_storage = thread->user_stack_base
+ thread->user_stack_size; + thread->user_stack_size;
@@ -530,8 +530,6 @@ void
arch_set_debug_cpu_state(const struct debug_cpu_state *cpuState) arch_set_debug_cpu_state(const struct debug_cpu_state *cpuState)
{ {
if (struct iframe *frame = i386_get_user_iframe()) { if (struct iframe *frame = i386_get_user_iframe()) {
struct thread *thread = thread_get_current_thread();
i386_frstor(cpuState->extended_regs); i386_frstor(cpuState->extended_regs);
// For this to be correct the calling function must not use these // For this to be correct the calling function must not use these
// registers (not even indirectly). // registers (not even indirectly).
@@ -564,8 +562,6 @@ void
arch_get_debug_cpu_state(struct debug_cpu_state *cpuState) arch_get_debug_cpu_state(struct debug_cpu_state *cpuState)
{ {
if (struct iframe *frame = i386_get_user_iframe()) { if (struct iframe *frame = i386_get_user_iframe()) {
struct thread *thread = thread_get_current_thread();
i386_fnsave(cpuState->extended_regs); i386_fnsave(cpuState->extended_regs);
// For this to be correct the calling function must not use these // For this to be correct the calling function must not use these
// registers (not even indirectly). // registers (not even indirectly).
+1 -1
View File
@@ -6,5 +6,5 @@ KernelMergeObject kernel_cache.o :
file_map.cpp file_map.cpp
vnode_store.cpp vnode_store.cpp
: $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused : $(TARGET_KERNEL_PIC_CCFLAGS)
; ;
+1 -1
View File
@@ -17,5 +17,5 @@ KernelMergeObject kernel_debug.o :
tracing.cpp tracing.cpp
user_debugger.cpp user_debugger.cpp
: $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused : $(TARGET_KERNEL_PIC_CCFLAGS)
; ;
-3
View File
@@ -87,7 +87,6 @@ static const uint32 kMaxDebuggerModules = sizeof(sDebuggerModules)
#define HISTORY_SIZE 16 #define HISTORY_SIZE 16
static char sLineBuffer[HISTORY_SIZE][LINE_BUFFER_SIZE] = { "", }; static char sLineBuffer[HISTORY_SIZE][LINE_BUFFER_SIZE] = { "", };
static char sParseLine[LINE_BUFFER_SIZE];
static int32 sCurrentLine = 0; static int32 sCurrentLine = 0;
#define distance(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) #define distance(a, b) ((a) < (b) ? (b) - (a) : (a) - (b))
@@ -880,8 +879,6 @@ syslog_init(struct kernel_args *args)
syslog_write(revisionBuffer, length); syslog_write(revisionBuffer, length);
return B_OK; return B_OK;
err3:
free(sSyslogBuffer);
err2: err2:
free(sSyslogMessage); free(sSyslogMessage);
err1: err1:
@@ -392,7 +392,6 @@ sort_debugger_commands()
} }
if (strcmp((*command)->name, nextCommand->name) > 0) { if (strcmp((*command)->name, nextCommand->name) > 0) {
debugger_command* tmpCommand = nextCommand->next;
(*command)->next = nextCommand->next; (*command)->next = nextCommand->next;
nextCommand->next = *command; nextCommand->next = *command;
*command = nextCommand; *command = nextCommand;
@@ -109,9 +109,6 @@ free_temporary_variable_slot()
static Variable* static Variable*
get_variable(const char* variableName, bool create) get_variable(const char* variableName, bool create)
{ {
Variable* variables;
int variableCount;
// find the variable in the respective array and a free slot, we can // find the variable in the respective array and a free slot, we can
// use, if it doesn't exist yet // use, if it doesn't exist yet
Variable* freeSlot = NULL; Variable* freeSlot = NULL;
@@ -2214,7 +2214,6 @@ void
_user_debugger(const char *userMessage) _user_debugger(const char *userMessage)
{ {
// install the default debugger, if there is none yet // install the default debugger, if there is none yet
struct thread *thread = thread_get_current_thread();
port_id nubPort; port_id nubPort;
status_t error = ensure_debugger_installed(B_CURRENT_TEAM, &nubPort); status_t error = ensure_debugger_installed(B_CURRENT_TEAM, &nubPort);
if (error != B_OK) { if (error != B_OK) {
+1 -1
View File
@@ -13,5 +13,5 @@ KernelMergeObject kernel_device_manager.o :
# probe.cpp # probe.cpp
settings.cpp settings.cpp
: :
$(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused $(TARGET_KERNEL_PIC_CCFLAGS)
; ;
+1 -4
View File
@@ -1190,7 +1190,6 @@ devfs_read_link(fs_volume *_volume, fs_vnode *_link, char *buffer,
size_t *_bufferSize) size_t *_bufferSize)
{ {
struct devfs_vnode *link = (struct devfs_vnode *)_link->private_node; struct devfs_vnode *link = (struct devfs_vnode *)_link->private_node;
size_t bufferSize = *_bufferSize;
if (!S_ISLNK(link->stream.type)) if (!S_ISLNK(link->stream.type))
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -1461,7 +1460,6 @@ static status_t
devfs_ioctl(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, ulong op, devfs_ioctl(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, ulong op,
void *buffer, size_t length) void *buffer, size_t length)
{ {
struct devfs *fs = (struct devfs *)_volume->private_volume;
struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode->private_node; struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode->private_node;
struct devfs_cookie *cookie = (struct devfs_cookie *)_cookie; struct devfs_cookie *cookie = (struct devfs_cookie *)_cookie;
@@ -1499,8 +1497,8 @@ devfs_ioctl(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, ulong op,
case B_GET_DRIVER_FOR_DEVICE: case B_GET_DRIVER_FOR_DEVICE:
{ {
const char* path;
#if 0 #if 0
const char* path;
if (!vnode->stream.u.dev.driver) if (!vnode->stream.u.dev.driver)
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
path = vnode->stream.u.dev.driver->path; path = vnode->stream.u.dev.driver->path;
@@ -1531,7 +1529,6 @@ devfs_ioctl(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, ulong op,
case B_GET_PATH_FOR_DEVICE: case B_GET_PATH_FOR_DEVICE:
{ {
char path[256]; char path[256];
status_t err;
/* TODO: we might want to actually find the mountpoint /* TODO: we might want to actually find the mountpoint
* of that instance of devfs... * of that instance of devfs...
* but for now we assume it's mounted on /dev * but for now we assume it's mounted on /dev
@@ -194,8 +194,6 @@ static device_node *sRootNode;
static recursive_lock sLock; static recursive_lock sLock;
static const char* sGenericContextPath; static const char* sGenericContextPath;
static uint32 sDriverUpdateCycle = 1;
// #pragma mark - // #pragma mark -
@@ -178,7 +178,6 @@ static status_t unload_driver(legacy_driver *driver);
static status_t load_driver(legacy_driver *driver); static status_t load_driver(legacy_driver *driver);
static int32 sDefaultApiVersion = 1;
static hash_table* sDriverHash; static hash_table* sDriverHash;
static DriverWatcher sDriverWatcher; static DriverWatcher sDriverWatcher;
static int32 sDriverEvents; static int32 sDriverEvents;
@@ -334,8 +333,6 @@ load_driver(legacy_driver *driver)
{ {
status_t (*init_hardware)(void); status_t (*init_hardware)(void);
status_t (*init_driver)(void); status_t (*init_driver)(void);
const char **devicePaths;
int32 exported = 0;
status_t status; status_t status;
driver->binary_updated = false; driver->binary_updated = false;
@@ -417,10 +414,6 @@ load_driver(legacy_driver *driver)
driver->image = image; driver->image = image;
return republish_driver(driver); return republish_driver(driver);
error3:
if (driver->uninit_driver)
driver->uninit_driver();
error2: error2:
if (driver->uninit_hardware) if (driver->uninit_hardware)
driver->uninit_hardware(); driver->uninit_hardware();
@@ -679,10 +672,8 @@ reload_driver(legacy_driver *driver)
static void static void
handle_driver_events(void *_fs, int /*iteration*/) handle_driver_events(void */*_fs*/, int /*iteration*/)
{ {
struct devfs *fs = (devfs *)_fs;
if (atomic_and(&sDriverEvents, 0) == 0) if (atomic_and(&sDriverEvents, 0) == 0)
return; return;
@@ -33,7 +33,7 @@ KernelMergeObject kernel_disk_device_manager.o :
# disk device types # disk device types
DiskDeviceTypes.cpp DiskDeviceTypes.cpp
: $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused : $(TARGET_KERNEL_PIC_CCFLAGS)
; ;
# KFileDiskDevice.cpp needs the virtualdrive.h Header. Add it here to not # KFileDiskDevice.cpp needs the virtualdrive.h Header. Add it here to not
+1 -1
View File
@@ -17,5 +17,5 @@ KernelMergeObject kernel_fs.o :
vfs_boot.cpp vfs_boot.cpp
vfs_net_boot.cpp vfs_net_boot.cpp
: $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused : $(TARGET_KERNEL_PIC_CCFLAGS)
; ;
-2
View File
@@ -856,8 +856,6 @@ _user_seek(int fd, off_t pos, int seekType)
status_t status_t
_user_ioctl(int fd, ulong op, void *buffer, size_t length) _user_ioctl(int fd, ulong op, void *buffer, size_t length)
{ {
struct file_descriptor *descriptor;
if (!IS_USER_ADDRESS(buffer)) if (!IS_USER_ADDRESS(buffer))
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
+1 -1
View File
@@ -946,7 +946,7 @@ _user_recvmsg(int socket, struct msghdr *userMessage, int flags)
if (message.msg_controllen < 0) if (message.msg_controllen < 0)
return B_BAD_VALUE; return B_BAD_VALUE;
if (message.msg_controllen > MAX_ANCILLARY_DATA_LEN) if (message.msg_controllen > MAX_ANCILLARY_DATA_LEN)
message.msg_controllen > MAX_ANCILLARY_DATA_LEN; message.msg_controllen = MAX_ANCILLARY_DATA_LEN;
message.msg_control = ancillary = malloc(message.msg_controllen); message.msg_control = ancillary = malloc(message.msg_controllen);
if (message.msg_control == NULL) if (message.msg_control == NULL)
-12
View File
@@ -169,8 +169,6 @@ struct advisory_locking {
} }
}; };
static mutex sFileSystemsMutex = MUTEX_INITIALIZER("vfs_lock");
/*! \brief Guards sMountsTable. /*! \brief Guards sMountsTable.
The holder is allowed to read/write access the sMountsTable. The holder is allowed to read/write access the sMountsTable.
@@ -539,7 +537,6 @@ static status_t
get_mount(dev_t id, struct fs_mount **_mount) get_mount(dev_t id, struct fs_mount **_mount)
{ {
struct fs_mount *mount; struct fs_mount *mount;
status_t status;
MutexLocker nodeLocker(sVnodeMutex); MutexLocker nodeLocker(sVnodeMutex);
MutexLocker mountLocker(sMountMutex); MutexLocker mountLocker(sMountMutex);
@@ -1042,8 +1039,6 @@ vnode_low_memory_handler(void */*data*/, int32 level)
// Write back the modified pages of some unused vnodes and free them // Write back the modified pages of some unused vnodes and free them
uint32 freeCount = count;
for (uint32 i = 0; i < count; i++) { for (uint32 i = 0; i < count; i++) {
mutex_lock(&sVnodeMutex); mutex_lock(&sVnodeMutex);
struct vnode *vnode = (struct vnode *)list_remove_head_item( struct vnode *vnode = (struct vnode *)list_remove_head_item(
@@ -1846,7 +1841,6 @@ vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink,
while (true) { while (true) {
struct vnode *nextVnode; struct vnode *nextVnode;
ino_t vnodeID;
char *nextPath; char *nextPath;
TRACE(("vnode_path_to_vnode: top of loop. p = %p, p = '%s'\n", path, path)); TRACE(("vnode_path_to_vnode: top of loop. p = %p, p = '%s'\n", path, path));
@@ -4215,8 +4209,6 @@ vfs_free_io_context(void *_ioContext)
static status_t static status_t
vfs_resize_fd_table(struct io_context *context, const int newSize) vfs_resize_fd_table(struct io_context *context, const int newSize)
{ {
struct file_descriptor **fds;
if (newSize <= 0 || newSize > MAX_FD_TABLE_SIZE) if (newSize <= 0 || newSize > MAX_FD_TABLE_SIZE)
return EINVAL; return EINVAL;
@@ -4278,7 +4270,6 @@ vfs_resize_fd_table(struct io_context *context, const int newSize)
static status_t static status_t
vfs_resize_monitor_table(struct io_context *context, const int newSize) vfs_resize_monitor_table(struct io_context *context, const int newSize)
{ {
void *fds;
int status = B_OK; int status = B_OK;
if (newSize <= 0 || newSize > MAX_NODE_MONITORS) if (newSize <= 0 || newSize > MAX_NODE_MONITORS)
@@ -7208,8 +7199,6 @@ _kern_remove_dir(int fd, const char *path)
status_t status_t
_kern_read_link(int fd, const char *path, char *buffer, size_t *_bufferSize) _kern_read_link(int fd, const char *path, char *buffer, size_t *_bufferSize)
{ {
status_t status;
if (path) { if (path) {
KPath pathBuffer(path, false, B_PATH_NAME_LENGTH + 1); KPath pathBuffer(path, false, B_PATH_NAME_LENGTH + 1);
if (pathBuffer.InitCheck() != B_OK) if (pathBuffer.InitCheck() != B_OK)
@@ -7837,7 +7826,6 @@ _user_normalize_path(const char* userPath, bool traverseLink, char* buffer)
} }
// read link // read link
struct stat st;
if (HAS_FS_CALL(fileVnode, read_symlink)) { if (HAS_FS_CALL(fileVnode, read_symlink)) {
size_t bufferSize = B_PATH_NAME_LENGTH - 1; size_t bufferSize = B_PATH_NAME_LENGTH - 1;
error = FS_CALL(fileVnode, read_symlink, path, &bufferSize); error = FS_CALL(fileVnode, read_symlink, path, &bufferSize);
-2
View File
@@ -121,8 +121,6 @@ private:
return; return;
} }
status_t error = B_OK;
while (dirent* entry = readdir(dir)) { while (dirent* entry = readdir(dir)) {
// skip "." and ".." // skip "." and ".."
if (strcmp(entry->d_name, ".") == 0 if (strcmp(entry->d_name, ".") == 0
+1 -1
View File
@@ -12,5 +12,5 @@ KernelMergeObject kernel_messaging.o :
KMessage.cpp KMessage.cpp
MessagingService.cpp MessagingService.cpp
: $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused : $(TARGET_KERNEL_PIC_CCFLAGS)
; ;
@@ -377,7 +377,7 @@ MessagingService::UnregisterService()
// unset the other members // unset the other members
fLockSem = -1; fLockSem = -1;
fCounterSem -1; fCounterSem = -1;
fServerTeam = -1; fServerTeam = -1;
return B_OK; return B_OK;
+1 -1
View File
@@ -5,5 +5,5 @@ UsePrivateHeaders shared ;
KernelMergeObject kernel_posix.o : KernelMergeObject kernel_posix.o :
realtime_sem.cpp realtime_sem.cpp
: $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused : $(TARGET_KERNEL_PIC_CCFLAGS)
; ;
+1 -1
View File
@@ -6,5 +6,5 @@ KernelMergeObject kernel_slab.o :
allocator.cpp allocator.cpp
Slab.cpp Slab.cpp
: $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused : $(TARGET_KERNEL_PIC_CCFLAGS)
; ;
+1 -1
View File
@@ -11,5 +11,5 @@ KernelMergeObject kernel_util.o :
queue.c queue.c
ring_buffer.cpp ring_buffer.cpp
: $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused -DUSING_LIBGCC : $(TARGET_KERNEL_PIC_CCFLAGS) -DUSING_LIBGCC
; ;
+1 -1
View File
@@ -14,5 +14,5 @@ KernelMergeObject kernel_vm.o :
vm_store_null.c vm_store_null.c
#vm_tests.c #vm_tests.c
: $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused : $(TARGET_KERNEL_PIC_CCFLAGS)
; ;