libports: avoid implicit conversions

Issue #23
This commit is contained in:
Norman Feske 2021-12-06 15:34:55 +01:00
parent 8a1675e12e
commit dea467f692
16 changed files with 70 additions and 18 deletions

View File

@ -30,4 +30,4 @@ vpath %.c $(LIBDRM_PORT_DIR)
vpath %.c $(LIB_DIR)
vpath %.cc $(LIB_DIR)
CC_CXX_WARN_STRICE :=
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -9,3 +9,5 @@ LIBS += lwip
vpath %.cc $(VFS_DIR)
SHARED_LIB = yes
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -5,3 +5,5 @@ vpath %.cc $(REP_DIR)/src/lib/vfs/oss
LIBS := libc
SHARED_LIB := yes
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -16,6 +16,8 @@
#include <base/attached_rom_dataspace.h>
/* libc includes */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <fcntl.h>
#include <sys/stat.h>
@ -23,6 +25,8 @@
#include <archive.h>
#include <archive_entry.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
namespace Extract {
using namespace Genode;
struct Extracted_archive;

View File

@ -1,5 +1,5 @@
/*
* \brief Native fetchurl utility for Nix
* \brief Native fetchurl utility
* \author Emery Hemingway
* \date 2016-03-08
*/
@ -19,15 +19,20 @@
#include <base/heap.h>
#include <base/log.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
/* cURL includes */
#include <curl/curl.h>
/* Libc includes */
/* libc includes */
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
namespace Fetchurl {
class Fetch;
struct User_data;

View File

@ -25,6 +25,9 @@
#include <gui_session/connection.h>
#include <os/pixel_rgb888.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
/* MuPDF includes */
extern "C" {
#include <fitz.h>
@ -37,6 +40,7 @@ extern "C" {
#include <dirent.h>
#include <unistd.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
typedef Genode::Pixel_rgb888 pixel_t;
@ -58,7 +62,7 @@ static void copy_line_rgba(const unsigned char *rgba_src,
static int pdf_select(const struct dirent *d)
{
char const *name = d->d_name;
int n = strlen(name);
size_t n = strlen(name);
return (n > 4)
? (!strncmp(&name[n-4], ".pdf", 4))
: 0;

View File

@ -15,3 +15,5 @@ SRC_C = secs_to_tm.c tm_to_secs.c
INC_DIR += $(MUSL_TM)
vpath %.c $(MUSL_TM)
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -1,3 +1,5 @@
TARGET := stdin2out
SRC_CC := main.cc
LIBS += posix
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -21,6 +21,9 @@
#include <libc/component.h>
#include <os/pixel_rgb888.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
/* libuv */
#include <libyuv/convert_argb.h>
@ -29,6 +32,7 @@
#include <stdio.h>
#include <unistd.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
using namespace Genode;

View File

@ -24,7 +24,7 @@ genode_uint32_t genode_rand()
state = oldstate * 6364136223846793005ULL + inc;
// Calculate output function (XSH RR), uses old state for max ILP
uint32_t xorshifted = ((oldstate >> 18u) ^ oldstate) >> 27u;
uint32_t rot = oldstate >> 59u;
uint32_t xorshifted = (uint32_t)(((oldstate >> 18u) ^ oldstate) >> 27u);
uint32_t rot = (uint32_t)(oldstate >> 59u);
return (xorshifted >> rot) | (xorshifted << ((-rot) & 31));
}

View File

@ -106,7 +106,7 @@ extern "C" {
}
u32_t sys_now(void) {
return Lwip::sys_timer_ptr->timer.curr_time().trunc_to_plain_ms().value; }
return (u32_t)Lwip::sys_timer_ptr->timer.curr_time().trunc_to_plain_ms().value; }
void genode_memcpy(void *dst, const void *src, size_t len) {
Genode::memcpy(dst, src, len); }

View File

@ -0,0 +1,31 @@
/*
* \brief Libc includes for the libc_integration test
* \author Norman Feske
* \date 2021-12-10
*/
/*
* Copyright (C) 2021 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _LIBC_H_
#define _LIBC_H_
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <fcntl.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/select.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
#endif /* _LIBC_H_ */

View File

@ -16,16 +16,11 @@
* under the terms of the GNU Affero General Public License version 3.
*/
/* libc includes */
#include <string.h>
#include <errno.h>
#include <sys/select.h>
/* stdcxx includes */
#include <vector>
/* local includes */
#include "libc.h"
#include "definitions.h"
#include "fd_set.h"
#include "input_sender.h"

View File

@ -12,14 +12,11 @@
* under the terms of the GNU Affero General Public License version 3.
*/
/* libc includes */
#include <string.h>
#include <errno.h>
/* stdcxx includes */
#include <vector>
/* local includes */
#include "libc.h"
#include "thread.h"
#include "fd_set.h"
@ -104,7 +101,7 @@ void *worker_func(void *ptr)
}
/* simulate output creation requiring some time */
usleep(1000ull*random()%300);
usleep((unsigned)((1000ull*random()) % 300));
/* write remaining output bytes */
while (bytes_written < data_out.size()) {

View File

@ -1,3 +1,5 @@
TARGET = test-libc_vfs
LIBS = libc base
SRC_CC = main.cc
CC_CXX_WARN_STRICT_CONVERSION =

View File

@ -1,3 +1,5 @@
TARGET = test-memcpy
SRC_CC = main.cc
LIBS += libc
CC_CXX_WARN_STRICT_CONVERSION =