Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
saagarjha committed Nov 11, 2020
1 parent bf8ae39 commit 5c223f5
Show file tree
Hide file tree
Showing 14 changed files with 96 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// For iOS <13, where the app delegate owns the window instead of the scene
if ([NSUserDefaults.standardUserDefaults boolForKey:@"recovery"]) {
UINavigationController *vc = [[UIStoryboard storyboardWithName:@"About" bundle:nil] instantiateInitialViewController];
AboutViewController *avc = vc.topViewController;
AboutViewController *avc = (AboutViewController *) vc.topViewController;
avc.recoveryMode = YES;
self.window.rootViewController = vc;
return YES;
Expand Down
2 changes: 1 addition & 1 deletion app/SceneDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ @implementation SceneDelegate
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
if ([NSUserDefaults.standardUserDefaults boolForKey:@"recovery"]) {
UINavigationController *vc = [[UIStoryboard storyboardWithName:@"About" bundle:nil] instantiateInitialViewController];
AboutViewController *avc = vc.topViewController;
AboutViewController *avc = (AboutViewController *) vc.topViewController;
avc.recoveryMode = YES;
self.window.rootViewController = vc;
return;
Expand Down
56 changes: 55 additions & 1 deletion deps/libarchive.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@
BB10E0BB248DA573009C7A74 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1150;
LastUpgradeCheck = 1220;
TargetAttributes = {
BB10E0D5248DA67B009C7A74 = {
CreatedOnToolsVersion = 11.5;
Expand Down Expand Up @@ -718,12 +718,66 @@
BB10E0BF248DA573009C7A74 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
};
name = Debug;
};
BB10E0C0248DA573009C7A74 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion emu/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ static inline const char *reg32_name(enum reg32 reg) {
case reg_ebp: return "ebp";
case reg_esi: return "esi";
case reg_edi: return "edi";
default: return "?";
}
return "?";
}

#endif
2 changes: 2 additions & 0 deletions emu/float80-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <fenv.h>
#include "float80.h"

#pragma GCC diagnostic ignored "-Wliteral-range"

//#define DENORMAL 1e-310
#define DENORMAL 1.11253692925360069155e-308

Expand Down
19 changes: 19 additions & 0 deletions fs/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,22 @@ int generic_rmdirat(struct fd *at, const char *path_raw) {
mount_release(mount);
return err;
}

int generic_seek(struct fd *fd, off_t_ off, int whence, size_t size) {
off_t_ new_off = fd->offset;
if (whence == LSEEK_SET) {
fd->offset = off;
} else if (whence == LSEEK_CUR) {
if (!__builtin_add_overflow(new_off, off, &new_off) || new_off < 0)
return _EINVAL;
fd->offset = new_off;
} else if (whence == LSEEK_END) {
new_off = size + off;
if (new_off < 0)
return _EINVAL;
fd->offset = new_off;
} else {
return _EINVAL;
}
return 0;
}
2 changes: 1 addition & 1 deletion fs/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static ssize_t null_read(struct fd *UNUSED(fd), void *UNUSED(buf), size_t UNUSED
static ssize_t null_write(struct fd *UNUSED(fd), const void *UNUSED(buf), size_t bufsize) {
return bufsize;
}
static off_t_ null_lseek(struct fd *fd, off_t_ off, int whence) {
static off_t_ null_lseek(struct fd *UNUSED(fd), off_t_ UNUSED(off), int UNUSED(whence)) {
return 0;
}
struct dev_ops null_dev = {
Expand Down
16 changes: 3 additions & 13 deletions fs/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,10 @@ static off_t_ proc_seek(struct fd *fd, off_t_ off, int whence) {
if (err < 0)
return err;

off_t_ old_off = fd->offset;
if (whence == LSEEK_SET)
fd->offset = off;
else if (whence == LSEEK_CUR)
fd->offset += off;
else if (whence == LSEEK_END)
fd->offset = fd->proc.data.size + off;
else
return _EINVAL;
err = generic_seek(fd, off, whence, fd->proc.data.size);
if (err < 0)
return err;

if (fd->offset < 0) {
fd->offset = old_off;
return _EINVAL;
}
return fd->offset;
}

Expand Down
21 changes: 5 additions & 16 deletions fs/tmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,28 +428,17 @@ static ssize_t tmpfs_write(struct fd *fd, const void *buf, size_t bufsize) {
}

static off_t_ tmpfs_lseek(struct fd *fd, off_t_ off, int whence) {
qword_t size;
qword_t size = 0;
if (whence == LSEEK_END) {
struct tmp_inode *inode = tmpfs_fd_inode(fd);
lock(&inode->lock);
size = inode->stat.size;
}

// TODO: dedupe code with procfs
off_t_ old_off = fd->offset;
if (whence == LSEEK_SET)
fd->offset = off;
else if (whence == LSEEK_CUR)
fd->offset += off;
else if (whence == LSEEK_END)
fd->offset = size + off;
else
return _EINVAL;

if (fd->offset < 0) {
fd->offset = old_off;
return _EINVAL;
}
int err = generic_seek(fd, off, whence, size);
if (err < 0)
return err;

return fd->offset;
}

Expand Down
6 changes: 5 additions & 1 deletion iSH.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = "";
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1220;
TargetAttributes = {
BB13F7CA200ACC31003D1C4D = {
CreatedOnToolsVersion = 9.2;
Expand Down Expand Up @@ -1471,6 +1471,7 @@
BB4A922524ED9402002F5A96 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = CK5SXRTBR7;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1480,6 +1481,7 @@
BB4A922624ED9402002F5A96 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = CK5SXRTBR7;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1502,6 +1504,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -1545,6 +1548,7 @@
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down
2 changes: 1 addition & 1 deletion iSH.xcodeproj/xcshareddata/xcschemes/iSH.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1220"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 1 addition & 0 deletions kernel/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ int generic_rmdirat(struct fd *at, const char *path);
int generic_renameat(struct fd *src_at, const char *src, struct fd *dst_at, const char *dst);
int generic_symlinkat(const char *target, struct fd *at, const char *link);
int generic_mknodat(struct fd *at, const char *path, mode_t_ mode, dev_t_ dev);
int generic_seek(struct fd *fd, off_t_ off, int whence, size_t size);
#define AC_R 4
#define AC_W 2
#define AC_X 1
Expand Down
2 changes: 1 addition & 1 deletion kernel/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct task *pid_get_task_zombie(dword_t id); // don't return null if the task e

// TODO document
void task_start(struct task *task);
void task_run_current();
void task_run_current(void);

extern void (*exit_hook)(struct task *task, int code);

Expand Down
1 change: 0 additions & 1 deletion tools/fakefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ bool fakefs_import(const char *archive_path, const char *fs, struct fakefsify_er
char *slash = entry_path_copy;
while ((slash = strchr(slash + 1, '/')) != NULL) {
*slash = '\0';
size_t len = strlen(entry_path_copy);
int err = mkdirat(root_fd, fix_path(entry_path_copy), 0777);
*slash = '/';
if (err < 0) {
Expand Down

0 comments on commit 5c223f5

Please sign in to comment.