From f2176ce045bb9c591ee72b83eecb23f7a071f241 Mon Sep 17 00:00:00 2001 From: palumbon Date: Tue, 30 Apr 2024 15:29:53 +0200 Subject: [PATCH 1/6] Refactoring code to avoid warning --- smalltalksrc/VMMaker/SocketPlugin.class.st | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/smalltalksrc/VMMaker/SocketPlugin.class.st b/smalltalksrc/VMMaker/SocketPlugin.class.st index aaa2a4faf1..d598f17887 100644 --- a/smalltalksrc/VMMaker/SocketPlugin.class.st +++ b/smalltalksrc/VMMaker/SocketPlugin.class.st @@ -1048,8 +1048,9 @@ SocketPlugin >> socketValueOf: socketOop [ "Answer a pointer to the first byte of of the socket record within the given Smalltalk object, or nil if socketOop is not a socket record." - ^((interpreterProxy isBytes: socketOop) + ((interpreterProxy isBytes: socketOop) and: [(interpreterProxy byteSizeOf: socketOop) = self socketRecordSize]) - ifTrue: [self cCoerce: (interpreterProxy firstIndexableField: socketOop) to: #SocketPtr] - ifFalse: [interpreterProxy primitiveFailFor: PrimErrBadArgument. nil] + ifFalse: [interpreterProxy primitiveFailFor: PrimErrBadArgument. ^ nil]. + + ^ self cCoerce: (interpreterProxy firstIndexableField: socketOop) to: #SocketPtr ] From d0c1d6945b250d932793d72e2ab81011d1249266 Mon Sep 17 00:00:00 2001 From: palumbon Date: Tue, 30 Apr 2024 16:00:39 +0200 Subject: [PATCH 2/6] Adding sqInt return type declaration on StackInterpreter>>#stackPointerIndexForFrame: --- smalltalksrc/VMMaker/StackInterpreter.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/smalltalksrc/VMMaker/StackInterpreter.class.st b/smalltalksrc/VMMaker/StackInterpreter.class.st index df2c88e43d..882887912b 100644 --- a/smalltalksrc/VMMaker/StackInterpreter.class.st +++ b/smalltalksrc/VMMaker/StackInterpreter.class.st @@ -14736,6 +14736,7 @@ StackInterpreter >> stackPointerIndexForFrame: theFP [ + thePage := stackPages stackPageFor: theFP. theSP := self findSPOf: theFP on: thePage. ^self stackPointerIndexForFrame: theFP WithSP: theSP From b4bf2493176d2a904fd104a7d08224cc9e1d3073 Mon Sep 17 00:00:00 2001 From: palumbon Date: Tue, 30 Apr 2024 16:04:06 +0200 Subject: [PATCH 3/6] Remove -Wno-conditional-type-mismatch flag --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5a4893a4c..e9cf361fdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -329,7 +329,6 @@ add_compile_options( -Wno-deprecated-declarations -Wno-pointer-to-int-cast -Wno-compare-distinct-pointer-types - -Wno-conditional-type-mismatch -Wno-incompatible-function-pointer-types -Wno-return-type -Wno-unused-local-typedef From b4e506b503c5f30b39856d1d0653de16b4f33922 Mon Sep 17 00:00:00 2001 From: palumbon Date: Tue, 30 Apr 2024 16:11:45 +0200 Subject: [PATCH 4/6] Avoid no-conditional-type-mismatch on C code --- .../plugins/SocketPlugin/src/common/SocketPlugin.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extracted/plugins/SocketPlugin/src/common/SocketPlugin.c b/extracted/plugins/SocketPlugin/src/common/SocketPlugin.c index 989facd250..f8ed75a128 100644 --- a/extracted/plugins/SocketPlugin/src/common/SocketPlugin.c +++ b/extracted/plugins/SocketPlugin/src/common/SocketPlugin.c @@ -2306,11 +2306,11 @@ socketRecordSize(void) static SocketPtr socketValueOf(sqInt socketOop) { - return ((isBytes(socketOop)) - && ((byteSizeOf(socketOop)) == (sizeof(SQSocket))) - ? ((SocketPtr) (firstIndexableField(socketOop))) - : (primitiveFailFor(PrimErrBadArgument), - null)); + if ((isBytes(socketOop)) && ((byteSizeOf(socketOop)) == (sizeof(SQSocket)))) { + return (SocketPtr) (firstIndexableField(socketOop)); + } + primitiveFailFor(PrimErrBadArgument); + return null; } /* SmartSyntaxInterpreterPlugin>>#sqAssert: */ From b45e163d83ca7ff68098cf18fef97b8084928fd7 Mon Sep 17 00:00:00 2001 From: palumbon Date: Tue, 30 Apr 2024 16:41:46 +0200 Subject: [PATCH 5/6] Fix -Wno-incompatible-pointer-types warning --- CMakeLists.txt | 1 - extracted/plugins/FilePlugin/include/common/FilePlugin.h | 2 +- .../plugins/FilePlugin/src/common/sqFilePluginBasicPrims.c | 2 +- extracted/plugins/FilePlugin/src/win/sqWin32FilePrims.c | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9cf361fdf..3b2bb8c6c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -332,7 +332,6 @@ add_compile_options( -Wno-incompatible-function-pointer-types -Wno-return-type -Wno-unused-local-typedef - -Wno-incompatible-pointer-types -Wno-shift-negative-value -Wno-unknown-warning-option ) diff --git a/extracted/plugins/FilePlugin/include/common/FilePlugin.h b/extracted/plugins/FilePlugin/include/common/FilePlugin.h index 94b1b40cb6..1ec7fc23d2 100644 --- a/extracted/plugins/FilePlugin/include/common/FilePlugin.h +++ b/extracted/plugins/FilePlugin/include/common/FilePlugin.h @@ -53,7 +53,7 @@ squeakFileOffsetType sqFileGetPosition(SQFile *f); sqInt sqFileInit(void); sqInt sqFileShutdown(void); sqInt sqFileOpen(SQFile *f, char *sqFileName, sqInt sqFileNameSize, sqInt writeFlag); -sqInt sqFileOpenNew(SQFile *f, char *sqFileName, sqInt sqFileNameSize, sqInt *exists); +sqInt sqFileOpenNew(SQFile *f, char *sqFileName, sqInt sqFileNameSize, int *exists); sqInt sqConnectToFileDescriptor(SQFile *f, int fd, sqInt writeFlag); sqInt sqConnectToFile(SQFile *f, void *file, sqInt writeFlag); size_t sqFileReadIntoAt(SQFile *f, size_t count, char *byteArrayIndex, size_t startIndex); diff --git a/extracted/plugins/FilePlugin/src/common/sqFilePluginBasicPrims.c b/extracted/plugins/FilePlugin/src/common/sqFilePluginBasicPrims.c index 4bf714a921..af052cb4b9 100644 --- a/extracted/plugins/FilePlugin/src/common/sqFilePluginBasicPrims.c +++ b/extracted/plugins/FilePlugin/src/common/sqFilePluginBasicPrims.c @@ -410,7 +410,7 @@ sqFileOpen(SQFile *f, char *sqFileName, sqInt sqFileNameSize, sqInt writeFlag) { } sqInt -sqFileOpenNew(SQFile *f, char *sqFileName, sqInt sqFileNameSize, sqInt *exists) { +sqFileOpenNew(SQFile *f, char *sqFileName, sqInt sqFileNameSize, int *exists) { /* Opens the given file for writing and if possible reading if it does not already exist using the supplied sqFile structure to record its state. diff --git a/extracted/plugins/FilePlugin/src/win/sqWin32FilePrims.c b/extracted/plugins/FilePlugin/src/win/sqWin32FilePrims.c index aca7c678ef..1ae648ce48 100644 --- a/extracted/plugins/FilePlugin/src/win/sqWin32FilePrims.c +++ b/extracted/plugins/FilePlugin/src/win/sqWin32FilePrims.c @@ -212,7 +212,7 @@ sqInt sqFileOpen(SQFile *f, char* fileNameIndex, sqInt fileNameSize, sqInt write return 1; } -sqInt sqFileOpenNew(SQFile *f, char* fileNameIndex, sqInt fileNameSize, sqInt* exists) { +sqInt sqFileOpenNew(SQFile *f, char* fileNameIndex, sqInt fileNameSize, int* exists) { HANDLE h; WCHAR *win32Path = NULL; From e13807311e37c94d26283c9d5a133701af4001d0 Mon Sep 17 00:00:00 2001 From: palumbon Date: Tue, 30 Apr 2024 17:07:26 +0200 Subject: [PATCH 6/6] Fix (non)const incompatible types --- src/client.c | 6 ++---- src/parameters/parameters.m | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/client.c b/src/client.c index cc5a5694ff..a2c8259205 100644 --- a/src/client.c +++ b/src/client.c @@ -32,7 +32,7 @@ void mtfsfi(unsigned long long fpscr) # define mtfsfi(fpscr) #endif -static int loadPharoImage(const char* fileName); +static int loadPharoImage(char* fileName); static void* runVMThread(void* p); static int runOnMainThread(VMParameters *parameters); #ifdef PHARO_VM_IN_WORKER_THREAD @@ -204,10 +204,8 @@ vm_main(int argc, const char** argv, const char** env) } static int -loadPharoImage(const char* fileName) +loadPharoImage(char* fileName) { - struct stat sb; - /* Check image exists */ if (!sqImageFileExists(fileName)) { logErrorFromErrno("Image file not found"); diff --git a/src/parameters/parameters.m b/src/parameters/parameters.m index d2d80d71e0..17dafb9cbd 100644 --- a/src/parameters/parameters.m +++ b/src/parameters/parameters.m @@ -122,7 +122,7 @@ char* valueString = calloc(1, 255+1); CFStringGetCString(value, valueString, 255 + 1, kCFStringEncodingUTF8); - vm_parameter_vector_insert_from(¶meters->imageParameters, 1, &valueString); + vm_parameter_vector_insert_from(¶meters->imageParameters, 1, (const char**) &valueString); } }