- Disable output of empty header files
- Remove incorrect header styles - Use export.replace where header style was previously needed - Check compilation of tests using system gcc
This commit is contained in:
@@ -31,6 +31,7 @@ all: | libc libm
|
||||
clean:
|
||||
$(CARGO) clean
|
||||
make -C tests clean
|
||||
rm -rf sysroot
|
||||
|
||||
check:
|
||||
$(CARGO) check
|
||||
@@ -39,16 +40,16 @@ fmt:
|
||||
./fmt.sh
|
||||
|
||||
install: all
|
||||
mkdir -pv "$(DESTDIR)/lib"
|
||||
mkdir -pv "$(DESTDIR)/include"
|
||||
cp -rv "include"/* "$(DESTDIR)/include"
|
||||
cp -rv "$(BUILD)/include"/* "$(DESTDIR)/include"
|
||||
cp -v "openlibm/include"/*.h "$(DESTDIR)/include"
|
||||
cp -v "openlibm/src"/*.h "$(DESTDIR)/include"
|
||||
mkdir -pv "$(DESTDIR)/lib"
|
||||
cp -v "$(BUILD)/release/libc.a" "$(DESTDIR)/lib"
|
||||
cp -v "$(BUILD)/release/crt0.o" "$(DESTDIR)/lib"
|
||||
cp -v "$(BUILD)/release/crti.o" "$(DESTDIR)/lib"
|
||||
cp -v "$(BUILD)/release/crtn.o" "$(DESTDIR)/lib"
|
||||
cp -rv "openlibm/include"/* "$(DESTDIR)/include"
|
||||
cp -rv "openlibm/src"/*.h "$(DESTDIR)/include"
|
||||
cp -v "$(BUILD)/openlibm/libopenlibm.a" "$(DESTDIR)/lib/libm.a"
|
||||
|
||||
libc: $(BUILD)/release/libc.a $(BUILD)/release/crt0.o $(BUILD)/release/crti.o $(BUILD)/release/crtn.o $(BUILD)/include
|
||||
|
||||
+1
-2
@@ -1,2 +1 @@
|
||||
#define OPENLIBM_USE_HOST_FENV_H 1
|
||||
#include <openlibm.h>
|
||||
#include <openlibm_complex.h>
|
||||
|
||||
+1
-4
@@ -1,4 +1 @@
|
||||
#define OPENLIBM_USE_HOST_FENV_H 1
|
||||
#include <openlibm.h>
|
||||
#undef I
|
||||
#undef complex
|
||||
#include <openlibm_math.h>
|
||||
|
||||
@@ -5,3 +5,6 @@ style = "Tag"
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
|
||||
[export.rename]
|
||||
"in_addr" = "struct in_addr"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
sys_includes = []
|
||||
include_guard = "_LIMITS_H"
|
||||
trailer = "#include <bits/limits.h>"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
trailer = "#include <bits/limits.h>"
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
pub mod aio;
|
||||
pub mod _aio;
|
||||
pub mod arpa_inet;
|
||||
pub mod assert;
|
||||
pub mod ctype;
|
||||
@@ -9,7 +9,7 @@ pub mod fenv;
|
||||
pub mod float;
|
||||
pub mod fnmatch;
|
||||
pub mod getopt;
|
||||
pub mod grp;
|
||||
pub mod _grp;
|
||||
pub mod inttypes;
|
||||
pub mod libgen;
|
||||
pub mod limits;
|
||||
@@ -45,4 +45,4 @@ pub mod time;
|
||||
pub mod unistd;
|
||||
pub mod utime;
|
||||
pub mod wchar;
|
||||
pub mod wctype;
|
||||
pub mod _wctype;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
[package]
|
||||
name = "netinet"
|
||||
version = "0.1.0"
|
||||
authors = ["Dan Robertson <danlrobertson89@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
in_h = { path = "in" }
|
||||
@@ -1,7 +1,7 @@
|
||||
sys_includes = ["sys/types.h", "sys/socket.h"]
|
||||
include_guard = "_NETINET_IN_H"
|
||||
style = "Both"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
|
||||
[export]
|
||||
include = ["sockaddr_in6", "sockaddr_in", "ipv6_mreq"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
sys_includes = ["sys/ioctl.h"]
|
||||
include_guard = "_SGTTY_H"
|
||||
style = "Tag"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
sys_includes = ["stdint.h", "sys/types.h", "bits/signal.h"]
|
||||
include_guard = "_SIGNAL_H"
|
||||
style = "Tag"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
|
||||
[defines]
|
||||
"target_os=linux" = "__linux__"
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
include_guard = "_SYS_IOCTL_H"
|
||||
language = "C"
|
||||
|
||||
# WORKAROUND:
|
||||
# sgtty is used by another header, and cbindgen doesn't prefix that with `struct` :|
|
||||
style = "Both"
|
||||
style = "Tag"
|
||||
|
||||
[defines]
|
||||
"target_os=linux" = "__linux__"
|
||||
|
||||
@@ -2,10 +2,10 @@ sys_includes = ["sys/types.h", "stdint.h", "sys/time.h"]
|
||||
include_guard = "_SYS_RESOURCE_H"
|
||||
trailer = "#include <bits/sys/resource.h>"
|
||||
language = "C"
|
||||
|
||||
# WORKAROUND:
|
||||
# Rusage is used by another header, and cbindgen does not prefix that usage with `struct` :|
|
||||
style = "Both"
|
||||
style = "Tag"
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
|
||||
[export.rename]
|
||||
"timeval" = "struct timeval"
|
||||
|
||||
@@ -8,5 +8,7 @@ prefix_with_name = true
|
||||
|
||||
[export]
|
||||
# fd_set is also defined in C because cbindgen is incompatible with mem::size_of booo
|
||||
|
||||
exclude = ["FD_SETSIZE", "fd_set"]
|
||||
|
||||
[export.rename]
|
||||
"timeval" = "struct timeval"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
sys_includes = ["stddef.h", "stdint.h", "sys/types.h"]
|
||||
include_guard = "_SYS_SOCKET_H"
|
||||
style = "Both"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
|
||||
[defines]
|
||||
"target_os=linux" = "__linux__"
|
||||
|
||||
@@ -6,3 +6,6 @@ style = "Tag"
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
|
||||
[export.rename]
|
||||
"timespec" = "struct timespec"
|
||||
|
||||
@@ -2,10 +2,7 @@ sys_includes = ["sys/types.h"]
|
||||
include_guard = "_SYS_TIME_H"
|
||||
language = "C"
|
||||
trailer = "#include <bits/sys/time.h>"
|
||||
|
||||
# WORKAROUND:
|
||||
# Timeval is used by another header, and cbindgen doesn't prefix that with `struct` :|
|
||||
style = "Both"
|
||||
style = "Tag"
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
sys_includes = ["sys/types.h", "sys/resource.h"]
|
||||
include_guard = "_SYS_WAIT_H"
|
||||
style = "Type"
|
||||
trailer = "#include <bits/sys/wait.h>"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
sys_includes = ["sys/types.h", "stdint.h", "stddef.h"]
|
||||
include_guard = "_TIME_H"
|
||||
language = "C"
|
||||
|
||||
# WORKAROUND:
|
||||
# Tm is used by another header, and cbindgen doesn't prefix that with `struct` :|
|
||||
style = "Both"
|
||||
style = "Tag"
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
|
||||
+1
-1
@@ -8,5 +8,5 @@ int main() {
|
||||
}
|
||||
char buffer[256];
|
||||
printf("%s", fgets(buffer, 256, f));
|
||||
printf("ftell: %d\n", ftello(f));
|
||||
printf("ftell: %ld\n", ftello(f));
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -14,6 +14,6 @@ int main() {
|
||||
printf("release: '%s'\n", system_info.release);
|
||||
printf("version: '%s'\n", system_info.version);
|
||||
printf("machine: '%s'\n", system_info.machine);
|
||||
printf("domainname: '%s'\n", system_info.domainname);
|
||||
//printf("domainname: '%s'\n", system_info.domainname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
time_t a = 0;
|
||||
tm *time_info = gmtime(&a);
|
||||
struct tm *time_info = gmtime(&a);
|
||||
|
||||
char *time_string = asctime(time_info);
|
||||
|
||||
|
||||
+2
-2
@@ -5,10 +5,10 @@
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
time_t a = 0;
|
||||
tm expected = { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 1, .tm_year = 70,
|
||||
struct tm expected = { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 1, .tm_year = 70,
|
||||
.tm_wday = 4, .tm_yday = 0, .tm_isdst = 0, .tm_gmtoff = 0, .tm_zone = "UTC" };
|
||||
|
||||
tm *info = gmtime(&a);
|
||||
struct tm *info = gmtime(&a);
|
||||
if (info->tm_sec != expected.tm_sec || info->tm_min != expected.tm_min ||
|
||||
info->tm_hour != expected.tm_hour || info->tm_mday != expected.tm_mday ||
|
||||
info->tm_year != expected.tm_year || info->tm_wday != expected.tm_wday ||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
timespec tm = {0, 0};
|
||||
struct timespec tm = {0, 0};
|
||||
clock_gettime(CLOCK_REALTIME, &tm);
|
||||
perror("clock_gettime");
|
||||
time(NULL);
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ int main()
|
||||
perror("pipe write");
|
||||
return 1;
|
||||
} else if (bytes != strlen(outstring)) {
|
||||
fprintf(stderr, "pipe write: %d != %d\n", bytes, strlen(outstring));
|
||||
fprintf(stderr, "pipe write: %d != %ld\n", bytes, strlen(outstring));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ int main()
|
||||
perror("pipe read");
|
||||
return 1;
|
||||
} else if (bytes != strlen(outstring)) {
|
||||
fprintf(stderr, "pipe read: %d != %d\n", bytes, strlen(outstring));
|
||||
fprintf(stderr, "pipe read: %d != %ld\n", bytes, strlen(outstring));
|
||||
return 1;
|
||||
} else if (memcmp(instring, outstring, sizeof(outstring)) != 0) {
|
||||
fprintf(stderr, "pipe read does not match pipe write\n");
|
||||
|
||||
@@ -7,7 +7,7 @@ int main(int argc, char** argv) {
|
||||
perror("sleep");
|
||||
usleep(1000);
|
||||
perror("usleep");
|
||||
timespec tm = {0, 10000};
|
||||
struct timespec tm = {0, 10000};
|
||||
nanosleep(&tm, NULL);
|
||||
perror("nanosleep");
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
void print_as_wide(const char* mbstr)
|
||||
{
|
||||
mbstate_t state;
|
||||
@@ -10,14 +11,14 @@ void print_as_wide(const char* mbstr)
|
||||
mbsrtowcs(&wstr[0], &mbstr, len, &state);
|
||||
|
||||
//Should be 5
|
||||
printf("The length, including '\\0': %i \n",len);
|
||||
printf("The length, including '\\0': %li \n",len);
|
||||
|
||||
//missing wprintf to print this wide string
|
||||
//wprintf(L"The wide string: %ls \n", &wstr[0]);
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
const char* mbstr = u8"z\u00df\u6c34\U0001f34c"; // or u8"zß水🍌"
|
||||
print_as_wide(mbstr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user