Skip to content
Snippets Groups Projects
Commit bbddbb19 authored by Andre Maroneze's avatar Andre Maroneze Committed by Andre Maroneze
Browse files

[Libc] avoid GCC warnings in C stubs

parent 959a0281
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,7 @@ int glob(const char *pattern, int flags, ...@@ -71,7 +71,7 @@ int glob(const char *pattern, int flags,
for (size_t i = 0; i < reserve_offs; i++) pglob->gl_pathv[i] = 0; for (size_t i = 0; i < reserve_offs; i++) pglob->gl_pathv[i] = 0;
for (size_t i = 0; i < pglob->gl_pathc; i++) { for (size_t i = 0; i < pglob->gl_pathc; i++) {
pglob->gl_pathv[reserve_offs + prev_len + i] = "glob result"; pglob->gl_pathv[reserve_offs + prev_len + i] = (char*)"glob result";
} }
pglob->gl_pathv[prev_len + reserve_offs + pglob->gl_pathc] = 0; // terminator pglob->gl_pathv[prev_len + reserve_offs + pglob->gl_pathc] = 0; // terminator
if (Frama_C_nondet(0, 1)) { // simulate "no error" if (Frama_C_nondet(0, 1)) { // simulate "no error"
......
...@@ -23,11 +23,15 @@ ...@@ -23,11 +23,15 @@
#include "locale.h" #include "locale.h"
#include "limits.h" #include "limits.h"
__PUSH_FC_STDLIB __PUSH_FC_STDLIB
struct lconv __C_locale = {".","","","","","","","","","",CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX}; struct lconv __C_locale = {(char*)".",(char*)"",(char*)"",(char*)"",(char*)"",
(char*)"",(char*)"",(char*)"",(char*)"",(char*)"",
CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,
CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX,
CHAR_MAX,CHAR_MAX,CHAR_MAX,CHAR_MAX};
struct lconv *__frama_c_locale=&__C_locale; struct lconv *__frama_c_locale=&__C_locale;
char*__frama_c_locale_names[512]={"C"}; char*__frama_c_locale_names[512]={(char*)"C"};
char *setlocale(int category, const char *locale) { char *setlocale(int category, const char *locale) {
if (*locale == 'C') if (*locale == 'C')
{ __frama_c_locale = &__C_locale; { __frama_c_locale = &__C_locale;
......
...@@ -69,7 +69,7 @@ int getaddrinfo( ...@@ -69,7 +69,7 @@ int getaddrinfo(
ai -> ai_protocol = Frama_C_interval(0,IPPROTO_MAX); ai -> ai_protocol = Frama_C_interval(0,IPPROTO_MAX);
ai -> ai_addrlen = sizeof(*sa) ; ai -> ai_addrlen = sizeof(*sa) ;
ai -> ai_addr = sa ; ai -> ai_addr = sa ;
ai -> ai_canonname = "dummy" ; ai -> ai_canonname = (char*)"dummy" ;
ai -> ai_next = NULL; ai -> ai_next = NULL;
*res = ai; *res = ai;
return 0; return 0;
......
...@@ -121,7 +121,7 @@ extern void endservent(void); ...@@ -121,7 +121,7 @@ extern void endservent(void);
*/ */
extern void freeaddrinfo(struct addrinfo * addrinfo); extern void freeaddrinfo(struct addrinfo * addrinfo);
char *__fc_gai_strerror = "<error message reported by gai_strerror>"; char *__fc_gai_strerror = (char*)"<error message reported by gai_strerror>";
/*@ /*@
assigns \result \from indirect:errcode, __fc_gai_strerror; assigns \result \from indirect:errcode, __fc_gai_strerror;
......
...@@ -111,7 +111,7 @@ char *getenv(const char *name) ...@@ -111,7 +111,7 @@ char *getenv(const char *name)
int putenv(char *string) int putenv(char *string)
{ {
char *separator = strchr(string, '='); char *separator __attribute__((unused)) = strchr(string, '=');
//@ assert string_contains_separator: separator != \null; //@ assert string_contains_separator: separator != \null;
//@ assert name_is_not_empty: separator != string; //@ assert name_is_not_empty: separator != string;
......
...@@ -272,7 +272,9 @@ char *strstr(const char *haystack, const char *needle) ...@@ -272,7 +272,9 @@ char *strstr(const char *haystack, const char *needle)
} }
char __fc_strerror[64]; char __fc_strerror[64];
#ifdef __FRAMAC__
static int __fc_strerror_init; static int __fc_strerror_init;
#endif
char *strerror(int errnum) char *strerror(int errnum)
{ {
...@@ -318,7 +320,9 @@ char *strndup(const char *s, size_t n) ...@@ -318,7 +320,9 @@ char *strndup(const char *s, size_t n)
} }
char __fc_strsignal[64]; char __fc_strsignal[64];
#ifdef __FRAMAC__
static int __fc_strsignal_init; static int __fc_strsignal_init;
#endif
char *strsignal(int signum) char *strsignal(int signum)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment