[dev/lib][warnings] fix -Wmissing-declarations warnings in dev/ and lib/

This commit is contained in:
Travis Geiselbrecht
2021-10-21 23:16:20 -07:00
parent a895bcece5
commit fcb65c9a88
28 changed files with 49 additions and 24 deletions

View File

@@ -5,8 +5,3 @@
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
void dev_init(void) {
}

View File

@@ -405,6 +405,7 @@ enum handler_return __platform_irq(struct iframe *frame) {
return ret;
}
enum handler_return platform_irq(struct iframe *frame);
enum handler_return platform_irq(struct iframe *frame) {
#if WITH_LIB_SM
uint32_t ahppir = GICREG(0, GICC_AHPPIR);
@@ -447,6 +448,7 @@ enum handler_return platform_irq(struct iframe *frame) {
#endif
}
void platform_fiq(struct iframe *frame);
void platform_fiq(struct iframe *frame) {
#if WITH_LIB_SM
sm_handle_fiq();

View File

@@ -67,7 +67,7 @@ static struct fp_32_64 timer_freq_msec_conversion_inverse;
static void arm_cortex_a9_timer_init_percpu(uint level);
uint64_t get_global_val(void) {
static uint64_t get_global_val(void) {
uint32_t lo, hi;
retry:

View File

@@ -5,6 +5,7 @@
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#include <dev/timer/arm_generic.h>
#include <arch/ops.h>
#include <assert.h>

View File

@@ -535,7 +535,7 @@ static int virtio_gpu_flush_thread(void *arg) {
return 0;
}
void virtio_gpu_gfx_flush(uint starty, uint endy) {
static void virtio_gpu_gfx_flush(uint starty, uint endy) {
event_signal(&the_gdev->flush_event, !arch_ints_disabled());
}

View File

@@ -380,7 +380,7 @@ void virtio_status_driver_ok(struct virtio_device *dev) {
dev->mmio_config->status |= VIRTIO_STATUS_DRIVER_OK;
}
void virtio_init(uint level) {
static void virtio_init(uint level) {
}
LK_INIT_HOOK(virtio, &virtio_init, LK_INIT_LEVEL_THREADING);

View File

@@ -7,6 +7,8 @@
#include "zutil.h"
#include <lib/cksum.h>
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#define BASE 65521 /* largest prime smaller than 65536 */

View File

@@ -1,3 +1,4 @@
#include <lib/cksum.h>
/*
* Computes the CRC for transmitted and received data using
* the CCITT 16bit algorithm (X^16 + X^12 + X^5 + 1) with

View File

@@ -30,7 +30,7 @@
#include "zutil.h" /* for STDC and FAR definitions */
#define local static
#include <lib/cksum.h>
/* Definitions for doing the crc four data bytes at a time. */
#if !defined(NOBYFOUR) && defined(Z_U4)
@@ -188,7 +188,7 @@ local void write_table(out, table)
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
const z_crc_t FAR * ZEXPORT get_crc_table()
static const z_crc_t FAR * ZEXPORT get_crc_table()
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty)

View File

@@ -1,6 +1,8 @@
#ifndef __CKSUM_H
#define __CKSUM_H
#include <stdint.h>
#include <sys/types.h>
#include <lk/compiler.h>
__BEGIN_CDECLS
@@ -21,8 +23,12 @@ unsigned short crc16(const unsigned char *buf, unsigned int length);
unsigned short update_crc16(unsigned short crc, const unsigned char *buf, unsigned int len);
unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int len);
unsigned long crc32_combine(unsigned long, unsigned long, off_t len2);
unsigned long crc32_combine64(unsigned long, unsigned long, int64_t len2);
unsigned long adler32(unsigned long adler, const unsigned char *buf, unsigned int len);
unsigned long adler32_combine(unsigned long adler1, unsigned long adler2, off_t len2);
unsigned long adler32_combine64(unsigned long adler1, unsigned long adler2, int64_t len2);
__END_CDECLS

View File

@@ -19,4 +19,8 @@ int bcache_read_block(bcache_t, void *, uint block);
// get and put a pointer directly to the block
int bcache_get_block(bcache_t, void **, uint block);
int bcache_put_block(bcache_t, uint block);
int bcache_mark_block_dirty(bcache_t priv, uint blocknum);
int bcache_zero_block(bcache_t priv, uint blocknum);
int bcache_flush(bcache_t priv);
void bcache_dump(bcache_t priv, const char *name);

View File

@@ -11,6 +11,7 @@
#include <stdlib.h>
#include <printf.h>
#include <stdio.h>
#include <assert.h>
#include <lk/list.h>
#include <arch/ops.h>
#include <platform.h>

View File

@@ -75,7 +75,8 @@ static int ext2_calculate_block_pointer_pos(ext2_t *ext2, blocknum_t block_to_fi
}
// This function returns a pointer to the cache block that corresponds to the indirect block pointer.
int ext2_get_indirect_block_pointer_cache_block(ext2_t *ext2, struct ext2_inode *inode, blocknum_t **cache_block, uint32_t level, uint32_t pos[], uint *block_loaded) {
static int ext2_get_indirect_block_pointer_cache_block(ext2_t *ext2, struct ext2_inode *inode,
blocknum_t **cache_block, uint32_t level, uint32_t pos[], uint *block_loaded) {
uint32_t current_level = 0;
uint current_block = 0, last_block;
blocknum_t *block = NULL;

View File

@@ -18,7 +18,7 @@
#include "fat32_priv.h"
#include "fat_fs.h"
void fat32_dump(fat_fs_t *fat) {
static void fat32_dump(fat_fs_t *fat) {
printf("bytes_per_sector=%i\n", fat->bytes_per_sector);
printf("sectors_per_cluster=%i\n", fat->sectors_per_cluster);
printf("bytes_per_cluster=%i\n", fat->bytes_per_cluster);

View File

@@ -21,7 +21,7 @@
#define DIR_ENTRY_LENGTH 32
#define USE_CACHE 1
uint32_t fat32_next_cluster_in_chain(fat_fs_t *fat, uint32_t cluster) {
static uint32_t fat32_next_cluster_in_chain(fat_fs_t *fat, uint32_t cluster) {
uint32_t fat_sector = (cluster) >> 7;
uint32_t fat_index = (cluster ) & 127;
@@ -62,7 +62,7 @@ static inline off_t fat32_offset_for_cluster(fat_fs_t *fat, uint32_t cluster) {
return fat->lba_start + (cluster_begin_lba + (cluster - 2) * fat->sectors_per_cluster) * fat->bytes_per_sector;
}
char *fat32_dir_get_filename(uint8_t *dir, off_t offset, int lfn_sequences) {
static char *fat32_dir_get_filename(uint8_t *dir, off_t offset, int lfn_sequences) {
int result_len = 1 + (lfn_sequences == 0 ? 12 : (lfn_sequences * 26));
char *result = malloc(result_len);
int j = 0;

View File

@@ -61,7 +61,7 @@ static test tests[] = {
{&test_truncate_file, "Test that we can truncate a file.", 1},
};
bool test_setup(const char *dev_name, uint32_t toc_pages) {
static bool test_setup(const char *dev_name, uint32_t toc_pages) {
spifs_format_args_t args = {
.toc_pages = toc_pages,
};
@@ -83,7 +83,7 @@ bool test_setup(const char *dev_name, uint32_t toc_pages) {
return true;
}
bool test_teardown(void) {
static bool test_teardown(void) {
if (fs_unmount(MNT_PATH) != NO_ERROR) {
printf("Unmount failed\n");
return false;

View File

@@ -364,7 +364,7 @@ void gfx_line(gfx_surface *surface, uint x1, uint y1, uint x2, uint y2, uint col
}
}
uint32_t alpha32_add_ignore_destalpha(uint32_t dest, uint32_t src) {
static uint32_t alpha32_add_ignore_destalpha(uint32_t dest, uint32_t src) {
uint32_t cdest[3];
uint32_t csrc[3];

View File

@@ -100,5 +100,8 @@ void gfx_surface_destroy(struct gfx_surface *surface);
// utility routine to fill the display with a little moire pattern
void gfx_draw_pattern(void);
// fill the screen with white
void gfx_draw_pattern_white(void);
__END_CDECLS

View File

@@ -105,7 +105,7 @@ static ssize_t __debug_stdio_read(io_handle_t *io, char *s, size_t len) {
}
#if CONSOLE_HAS_INPUT_BUFFER
void console_init_hook(uint level) {
static void console_init_hook(uint level) {
cbuf_initialize_etc(&console_input_cbuf, sizeof(console_cbuf_buf), console_cbuf_buf);
}

View File

@@ -5,6 +5,7 @@
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#include <stdlib.h>
#include <lk/debug.h>
void abort(void) {

View File

@@ -6,6 +6,8 @@
* https://opensource.org/licenses/MIT
*/
#include <stdlib.h>
/* nulled out atexit. static object constructors call this */
int atexit(void (*func)(void)) {
return 0;

View File

@@ -8,6 +8,8 @@
/* some cruft we have to define when using the linux toolchain */
#include <unwind.h>
#pragma GCC diagnostic ignored "-Wmissing-declarations"
void *__dso_handle;
#if defined(__ARM_EABI_UNWINDER__) && __ARM_EABI_UNWINDER__

View File

@@ -44,6 +44,7 @@ void *bsearch(const void *key, const void *base, size_t num_elems, size_t size,
int (*compare)(const void *, const void *));
unsigned long int strtoul(const char *nptr, char **endptr, int base);
char *getenv(const char *name);
int atexit(void (*func)(void));
__END_CDECLS

View File

@@ -11,6 +11,7 @@
#include <endian.h>
#include <lk/list.h>
#include <stdint.h>
#include <iovec.h>
#include <sys/types.h>
#include <lib/pktbuf.h>
@@ -53,6 +54,7 @@ typedef struct udp_socket udp_socket_t;
int udp_listen(uint16_t port, udp_callback_t cb, void *arg);
status_t udp_open(uint32_t host, uint16_t sport, uint16_t dport, udp_socket_t **handle);
status_t udp_send(void *buf, size_t len, udp_socket_t *handle);
status_t udp_send_iovec(const iovec_t *iov, uint iov_count, udp_socket_t *handle);
status_t udp_close(udp_socket_t *handle);
/* tcp */

View File

@@ -17,7 +17,7 @@
#include <kernel/timer.h>
#include <lk/err.h>
uint32_t str_ip_to_int(const char *s, size_t len) {
static uint32_t str_ip_to_int(const char *s, size_t len) {
uint8_t ip[4] = { 0, 0, 0, 0 };
uint8_t pos = 0, i = 0;
@@ -35,7 +35,7 @@ uint32_t str_ip_to_int(const char *s, size_t len) {
return IPV4_PACK(ip);
}
void arp_usage(void) {
static void arp_usage(void) {
printf("arp list print arp table\n");
printf("arp query <ipv4 address> query arp address\n");
}

View File

@@ -97,7 +97,7 @@ void minip_init(tx_func_t tx_handler, void *tx_arg,
net_timer_init();
}
uint16_t ipv4_payload_len(struct ipv4_hdr *pkt) {
static uint16_t ipv4_payload_len(struct ipv4_hdr *pkt) {
return (pkt->len - ((pkt->ver_ihl >> 4) * 5));
}
@@ -123,7 +123,7 @@ void minip_build_ipv4_hdr(struct ipv4_hdr *ipv4, uint32_t dst, uint8_t proto, ui
ipv4->chksum = rfc1701_chksum((uint8_t *) ipv4, sizeof(struct ipv4_hdr));
}
int send_arp_request(uint32_t addr) {
static int send_arp_request(uint32_t addr) {
pktbuf_t *p;
struct eth_hdr *eth;
struct arp_pkt *arp;
@@ -215,7 +215,7 @@ err:
* According to spec the data portion doesn't matter, but ping itself validates that
* the payload is identical
*/
void send_ping_reply(uint32_t ipaddr, struct icmp_pkt *req, size_t reqdatalen) {
static void send_ping_reply(uint32_t ipaddr, struct icmp_pkt *req, size_t reqdatalen) {
pktbuf_t *p;
size_t len;
struct eth_hdr *eth;

View File

@@ -117,7 +117,7 @@ done:
return delay;
}
int net_timer_work_thread(void *args) {
static int net_timer_work_thread(void *args) {
for (;;) {
event_wait(&net_timer_event);

View File

@@ -88,6 +88,7 @@ void unittest_set_output_function (_printf_engine_output_func fun, void *arg);
* RUN_TEST.
*/
#define BEGIN_TEST_CASE(case_name) \
bool case_name(void); \
bool case_name(void) \
{ \
bool all_ok = true; \