Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings c compiler #789

Merged
merged 8 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,9 @@ add_compile_options(
-Wno-pointer-integer-compare
-Wno-unknown-pragmas
-Wno-pointer-sign
<<<<<<< HEAD
-Wno-constant-conversion
-Wno-tautological-pointer-compare
=======
>>>>>>> 66015f0470 (Re-enable warnings)
-Wno-deprecated-declarations
-Wno-pointer-to-int-cast
-Wno-compare-distinct-pointer-types
-Wno-conditional-type-mismatch
-Wno-return-type
-Wno-unused-local-typedef
-Wno-shift-negative-value
Expand Down
2 changes: 1 addition & 1 deletion extracted/plugins/FilePlugin/include/common/FilePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion extracted/plugins/FilePlugin/src/win/sqWin32FilePrims.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 5 additions & 5 deletions extracted/plugins/SocketPlugin/src/common/SocketPlugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment on lines -2309 to +2313
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would this rewrite remove the warning? do you know?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there is not the expression with the complex type I guess (split into many statements)

}

/* SmartSyntaxInterpreterPlugin>>#sqAssert: */
Expand Down
7 changes: 4 additions & 3 deletions smalltalksrc/VMMaker/SocketPlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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."
<returnTypeC: #SocketPtr>
^((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
]
1 change: 1 addition & 0 deletions smalltalksrc/VMMaker/StackInterpreter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14736,6 +14736,7 @@ StackInterpreter >> stackPointerIndexForFrame: theFP [
<var: #theFP type: #'char *'>
<var: #thePage type: #'StackPage *'>
<var: #theSP type: #'char *'>
<returnTypeC: #sqInt>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes :)

Is this a problem with the type inferencer? Something worth improving there as a separate issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not just the type inferer, the problem is to have char* types in pointers to the stack (the type inference is doing good it's work).

I already opened an issue for that.

thePage := stackPages stackPageFor: theFP.
theSP := self findSPOf: theFP on: thePage.
^self stackPointerIndexForFrame: theFP WithSP: theSP
Expand Down
6 changes: 2 additions & 4 deletions src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/parameters/parameters.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
char* valueString = calloc(1, 255+1);

CFStringGetCString(value, valueString, 255 + 1, kCFStringEncodingUTF8);
vm_parameter_vector_insert_from(&parameters->imageParameters, 1, &valueString);
vm_parameter_vector_insert_from(&parameters->imageParameters, 1, (const char**) &valueString);
}

}
Expand Down