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

clean unused parameter warnings #203

Merged
merged 8 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ if(DEV_MODE)
set(CMAKE_C_EXTENSIONS OFF)
add_c_flag_if_supported(-Wno-error=unused-command-line-argument
-Wall -Wextra -Wpedantic -Wfatal-errors -fstack-protector-strong
-Wno-self-assign
-Wno-unused-parameter
-Werror=missing-field-initializers
-Werror=excess-initializers
-Werror=strict-aliasing
Expand All @@ -48,6 +46,7 @@ if(DEV_MODE)
-W4
-we4013 # undefined; assuming extern returning int
-we4005 # macro redefinition
-wd4100 # unreferenced formal parameter
)
endif()

Expand Down
8 changes: 4 additions & 4 deletions corec/corec/helpers/charconvert/charconvert_osx.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,22 @@ void CharConvSU(charconv* Conv, char* Out, size_t OutLen, const utf16_t* In)
}
}

void CharConvSW(charconv* Conv, char* Out, size_t OutLen, const wchar_t* In)
void CharConvSW(charconv* UNUSED_PARAM(Conv), char* UNUSED_PARAM(Out), size_t UNUSED_PARAM(OutLen), const wchar_t* UNUSED_PARAM(In))
{
fprintf(stderr, "Not supported yet: %s with no CC\n", __FUNCTION__);
}

void CharConvWS(charconv* Conv, wchar_t* Out, size_t OutLen, const char* In)
void CharConvWS(charconv* UNUSED_PARAM(Conv), wchar_t* UNUSED_PARAM(Out), size_t UNUSED_PARAM(OutLen), const char* UNUSED_PARAM(In))
{
fprintf(stderr, "Not supported yet: %s with no CC\n", __FUNCTION__);
}

void CharConvUW(charconv* Conv, utf16_t* Out, size_t OutLen, const wchar_t* In)
void CharConvUW(charconv* UNUSED_PARAM(Conv), utf16_t* UNUSED_PARAM(Out), size_t UNUSED_PARAM(OutLen), const wchar_t* UNUSED_PARAM(In))
{
fprintf(stderr, "Not supported yet: %s with no CC\n", __FUNCTION__);
}

void CharConvWU(charconv* Conv, wchar_t* Out, size_t OutLen, const utf16_t* In)
void CharConvWU(charconv* UNUSED_PARAM(Conv), wchar_t* UNUSED_PARAM(Out), size_t UNUSED_PARAM(OutLen), const utf16_t* UNUSED_PARAM(In))
{
fprintf(stderr, "Not supported yet: %s with no CC\n", __FUNCTION__);
}
Expand Down
8 changes: 4 additions & 4 deletions corec/corec/helpers/file/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ extern "C" {

FILE_DLL void CoreC_FileInit(nodemodule* Module);

FILE_DLL bool_t PathIsFolder(nodecontext*, const tchar_t*);
FILE_DLL bool_t PathIsFolder(const tchar_t*);
// \param Force erase even if the file is read-only
// \param Safe put in the OS trash rather than a permanent erase
FILE_DLL bool_t FileErase(nodecontext*, const tchar_t*, bool_t Force, bool_t Safe);
FILE_DLL bool_t FileErase(const tchar_t*, bool_t Force, bool_t Safe);

FILE_DLL void RemovePathDelimiter(tchar_t* Path);
FILE_DLL void AddPathDelimiter(tchar_t* Path,size_t PathLen);
FILE_DLL const tchar_t* GetProtocol(const tchar_t* URL, tchar_t *_Protocol, int ProtoLen, bool_t* HasHost);
FILE_DLL void SplitPath(const tchar_t* Path, tchar_t* Dir, int DirLen, tchar_t* Name, int NameLen, tchar_t* Ext, int ExtLen);
FILE_DLL void AbsPath(tchar_t* Abs, int AbsLen, const tchar_t* Path, const tchar_t* Base);
FILE_DLL void AbsPathNormalize(tchar_t* Abs, size_t AbsLen);
FILE_DLL void ReduceLocalPath(tchar_t* Abs, size_t AbsLen);
FILE_DLL void AbsPathNormalize(tchar_t* Abs);
FILE_DLL void ReduceLocalPath(tchar_t* Abs);
FILE_DLL void RelPath(tchar_t* Rel, int RelLen, const tchar_t* Path, const tchar_t* Base);
FILE_DLL bool_t UpperPath(tchar_t* Path, tchar_t* Last, size_t LastLen);

Expand Down
6 changes: 3 additions & 3 deletions corec/corec/helpers/file/file_libc.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static filepos_t Seek(filestream* p,filepos_t Pos,int SeekMode)
return NewPos;
}

static err_t SetLength(filestream* p,dataid Id,const filepos_t* Data,size_t Size)
static err_t SetLength(filestream* p,dataid UNUSED_PARAM(Id),const filepos_t* Data,size_t Size)
{
if (Size != sizeof(filepos_t))
return ERR_INVALID_DATA;
Expand Down Expand Up @@ -260,7 +260,7 @@ META_DATA(TYPE_FILEPOS,STREAM_LENGTH,filestream,Length)
META_PARAM(STRING,NODE_PROTOCOL,T("file"))
META_END(STREAM_CLASS)

bool_t FileErase(nodecontext *p,const tchar_t* Path, bool_t Force, bool_t Safe)
bool_t FileErase(const tchar_t* Path, bool_t Force, bool_t UNUSED_PARAM(Safe))
{
if (Force)
{
Expand All @@ -277,7 +277,7 @@ bool_t FileErase(nodecontext *p,const tchar_t* Path, bool_t Force, bool_t Safe)
return unlink(Path) == 0;
}

bool_t PathIsFolder(nodecontext *p,const tchar_t* Path)
bool_t PathIsFolder(const tchar_t* Path)
{
struct stat file_stats;
if (stat(Path, &file_stats) == 0)
Expand Down
6 changes: 3 additions & 3 deletions corec/corec/helpers/file/file_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static err_t Write(filestream* p,const void* Data,size_t Size,size_t* Written)
return Err;
}

static err_t SetLength(filestream* p,dataid UNUSED_PARAM(Id),const filepos_t* Data,size_t UNUSED_PARAM(Size))
static err_t SetLength(filestream* p,dataid UNUSED_PARAM(Id),const filepos_t* Data,size_t Size)
{
err_t Result = ERR_NONE;
filepos_t Pos;
Expand Down Expand Up @@ -404,7 +404,7 @@ static bool_t FileRecycle(const tchar_t* Path)
return Ret == 0;
}

bool_t FileErase(nodecontext* UNUSED_PARAM(p),const tchar_t* Path, bool_t Force, bool_t Safe)
bool_t FileErase(const tchar_t* Path, bool_t Force, bool_t Safe)
{
if (Force)
{
Expand All @@ -422,7 +422,7 @@ bool_t FileErase(nodecontext* UNUSED_PARAM(p),const tchar_t* Path, bool_t Force,
return FileRecycle(Path);
}

bool_t PathIsFolder(nodecontext* UNUSED_PARAM(p),const tchar_t* Path)
bool_t PathIsFolder(const tchar_t* Path)
{
DWORD attr = GetFileAttributes(Path);
return (attr != (DWORD)-1) && (attr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY;
Expand Down
6 changes: 3 additions & 3 deletions corec/corec/helpers/file/tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ void AbsPath(tchar_t* Abs, int AbsLen, const tchar_t* Path, const tchar_t* Base)
Abs[0] = 0;

tcscat_s(Abs,AbsLen,Path);
AbsPathNormalize(Abs,AbsLen);
AbsPathNormalize(Abs);
}

void AbsPathNormalize(tchar_t* Abs,size_t AbsLen)
void AbsPathNormalize(tchar_t* Abs)
{
if (GetProtocol(Abs,NULL,0,NULL)!=Abs)
{
Expand All @@ -299,7 +299,7 @@ void AbsPathNormalize(tchar_t* Abs,size_t AbsLen)
}
}

void ReduceLocalPath(tchar_t* Abs,size_t UNUSED_PARAM(AbsLen))
void ReduceLocalPath(tchar_t* Abs)
{
tchar_t *Folder,*Back;
Folder = tcsstr(Abs,T("://")); // skip the protocol
Expand Down
2 changes: 1 addition & 1 deletion corec/corec/helpers/parser/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ NODE_DLL void TextAttribEx(textwriter*,const tchar_t* Name, const void* Data, si
NODE_DLL void TextSerializeNode(textwriter* Text, node* p, uint_fast32_t Mask, uint_fast32_t Filter);

NODE_DLL bool_t DataToString(tchar_t* Value, size_t ValueLen, const void* Data, size_t Size, dataflags Type);
NODE_DLL bool_t NodeToString(tchar_t* Value, size_t ValueLen, node* Node, node* Base);
NODE_DLL bool_t NodeToString(tchar_t* Value, size_t ValueLen, node* Node);

void ExprSkipSpace(const tchar_t** p);
NODE_DLL void ExprTrimSpace(tchar_t** p);
Expand Down
10 changes: 5 additions & 5 deletions corec/corec/helpers/parser/parser2.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ static NOINLINE bool_t FindParam(node* Base, findpin* Find, nodecontext* Context
return 0;
}

static bool_t PinToString(tchar_t* Value, size_t ValueLen, const pin* Data, node* Base)
static bool_t PinToString(tchar_t* Value, size_t ValueLen, const pin* Data)
{
if (NodeToString(Value,ValueLen,Data->Node,Base) && Data->Node)
if (NodeToString(Value,ValueLen,Data->Node) && Data->Node)
{
size_t n;
if (Value[0])
Expand All @@ -224,7 +224,7 @@ static bool_t PinToString(tchar_t* Value, size_t ValueLen, const pin* Data, node
return 1;
}

bool_t NodeToString(tchar_t* Value, size_t ValueLen, node* Node, node* UNUSED_PARAM(Base))
bool_t NodeToString(tchar_t* Value, size_t ValueLen, node* Node)
{
Value[0]=0;

Expand Down Expand Up @@ -425,11 +425,11 @@ NOINLINE bool_t DataToString(tchar_t* Value, size_t ValueLen, const void* Data,
break;

case TYPE_PIN:
PinToString(Value,ValueLen,(pin*)Data,NULL);
PinToString(Value,ValueLen,(pin*)Data);
break;

case TYPE_NODE:
NodeToString(Value,ValueLen,*(node**)Data,NULL);
NodeToString(Value,ValueLen,*(node**)Data);
break;

case TYPE_STRING:
Expand Down
17 changes: 6 additions & 11 deletions corec/corec/node/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,6 @@ static NOINLINE void UnlockModules(const nodeclass* Class)
}
}

static void UnlockModulesWithLock(nodecontext* p,const nodeclass* Class)
{
UnlockModules(Class);
}

static NOINLINE bool_t DataFree(nodecontext* p, node* Node, nodedata** i, bool_t DeletingNode)
{
datatype Type;
Expand Down Expand Up @@ -852,7 +847,7 @@ void Node_Destructor(node* Node)
Node->Magic = 0;
#endif

UnlockModulesWithLock(p,Class);
UnlockModules(Class);
}
}

Expand Down Expand Up @@ -898,7 +893,7 @@ err_t Node_Constructor(anynode* AnyNode, node* Node, size_t Size, fourcc_t Class
else
{
Node->VMT = NULL;
UnlockModulesWithLock(p,Class);
UnlockModules(Class);
}
}
else
Expand Down Expand Up @@ -1019,7 +1014,7 @@ static const nodemeta* BitLookup(const nodeclass* Class,dataid Id)
return NULL;
}

static NOINLINE int CmpLookup(const void* UNUSED_PARAM(p), const void* va, const void* vb)
static NOINLINE int CmpLookup(const void* p, const void* va, const void* vb)
{
const nodemetalookup* a = va;
const nodemetalookup* b = vb;
Expand Down Expand Up @@ -1260,7 +1255,7 @@ static node* NodeCreateFromClass(nodecontext* p, const nodeclass* Class, bool_t
Size = NodeSize(Class);
if (!Size)
{
UnlockModulesWithLock(p,Class);
UnlockModules(Class);
return NULL;
}

Expand All @@ -1277,7 +1272,7 @@ static node* NodeCreateFromClass(nodecontext* p, const nodeclass* Class, bool_t

if (Singleton && !AddSingleton(p,Node))
{
UnlockModulesWithLock(p,Class);
UnlockModules(Class);
return NULL;
}

Expand Down Expand Up @@ -1407,7 +1402,7 @@ static void EraseNode(nodecontext* p,node* Node,const nodeclass* Class)
Node->Magic = 0;
#endif

UnlockModulesWithLock(p,Class);
UnlockModules(Class);

if (!(Class->Flags & CFLAG_OWN_MEMORY))
MemHeap_Free(p->NodeHeap,Node,Size);
Expand Down
2 changes: 1 addition & 1 deletion corec/tests/file_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void DebugMessage(const tchar_t* Msg,...)
#endif
}

int main(int argc,char** argv)
int main(int UNUSED_PARAM(argc),char** UNUSED_PARAM(argv))
{
nodecontext Context;
NodeContext_Init(&Context,NULL,NULL,NULL);
Expand Down
2 changes: 1 addition & 1 deletion corec/tests/node_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void DebugMessage(const tchar_t* Msg,...)
#endif
}

int main(int argc,char** argv)
int main(int UNUSED_PARAM(argc),char** UNUSED_PARAM(argv))
{
node* p[10000];
int i;
Expand Down
2 changes: 1 addition & 1 deletion corec/tests/string_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void test_ptr(const char *Format, intptr_t Value)
printf("passed '%s'\n",String);
}

int main(int argc,char** argv)
int main(int UNUSED_PARAM(argc),char** argv)
{
#if defined(UNICODE)
ToStr = CharConvOpen(NULL,CHARSET_DEFAULT);
Expand Down
1 change: 0 additions & 1 deletion libebml2/ebml2/ebml.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ EBML_DLL void EBML_ElementForceDataSize(ebml_element *Element, filepos_t Size);
// type specific routines
EBML_DLL ebml_element *EBML_MasterFindFirstElt(ebml_master *Element, const ebml_context *Context, bool_t bCreateIfNull, bool_t SetDefault, int ForProfile);
EBML_DLL err_t EBML_MasterAppend(ebml_master *Element, ebml_element *Append);
EBML_DLL err_t EBML_MasterRemove(ebml_master *Element, ebml_element *Remove);
EBML_DLL ebml_element *EBML_MasterFindNextElt(ebml_master *Element, const ebml_element *Current, bool_t bCreateIfNull, bool_t SetDefault, int ForProfile);
EBML_DLL ebml_element *EBML_MasterAddElt(ebml_master *Element, const ebml_context *Context, bool_t SetDefault, int ForProfile);
EBML_DLL size_t EBML_MasterCount(const ebml_master *Element);
Expand Down
6 changes: 3 additions & 3 deletions libebml2/ebmlbinary.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "internal.h"
#include <corec/helpers/file/streams.h>

static err_t ReadData(ebml_binary *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC)
static err_t ReadData(ebml_binary *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int Scope, size_t UNUSED_PARAM(DepthCheckCRC))
{
err_t Result;

Expand Down Expand Up @@ -40,7 +40,7 @@ static err_t ReadData(ebml_binary *Element, struct stream *Input, const ebml_par
}

#if defined(CONFIG_EBML_WRITING)
static err_t RenderData(ebml_binary *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered)
static err_t RenderData(ebml_binary *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int UNUSED_PARAM(ForProfile), filepos_t *Rendered)
{
size_t Written;
err_t Err = Stream_Write(Output,ARRAYBEGIN(Element->Data,uint8_t),ARRAYCOUNT(Element->Data,uint8_t),&Written);
Expand All @@ -55,7 +55,7 @@ static void Delete(ebml_binary *Element)
ArrayClear(&Element->Data);
}

static bool_t IsDefaultValue(const ebml_binary *Element)
static bool_t IsDefaultValue(const ebml_binary *UNUSED_PARAM(Element))
{
return 0; // TODO: a default binary value needs a size too (use a structure to set the value in the structure)
}
Expand Down
6 changes: 3 additions & 3 deletions libebml2/ebmlcrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static bool_t ValidateSize(const ebml_element *p)
return EBML_ElementIsFiniteSize(p) && (p->DataSize == 4);
}

static err_t ReadData(ebml_crc *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC)
static err_t ReadData(ebml_crc *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int UNUSED_PARAM(Scope), size_t UNUSED_PARAM(DepthCheckCRC))
{
err_t Result;
uint32_t CRCbuffer;
Expand All @@ -152,7 +152,7 @@ static err_t ReadData(ebml_crc *Element, struct stream *Input, const ebml_parser
}

#if defined(CONFIG_EBML_WRITING)
static err_t RenderData(ebml_crc *Element, struct stream *Output, bool_t bForceWithoutMandatory, bool_t bWithDefault, int ForProfile, filepos_t *Rendered)
static err_t RenderData(ebml_crc *Element, struct stream *Output, bool_t UNUSED_PARAM(bForceWithoutMandatory), bool_t UNUSED_PARAM(bWithDefault), int UNUSED_PARAM(ForProfile), filepos_t *Rendered)
{
err_t Result;
size_t Written = 0;
Expand Down Expand Up @@ -182,7 +182,7 @@ static ebml_crc *Copy(const ebml_crc *Element)
return Result;
}

static bool_t IsDefaultValue(const ebml_element *Element)
static bool_t IsDefaultValue(const ebml_element *UNUSED_PARAM(Element))
{
return 0; // CRC has no default value
}
Expand Down
2 changes: 1 addition & 1 deletion libebml2/ebmldate.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static bool_t ValidateSize(const ebml_element *p)
return EBML_ElementIsFiniteSize(p) && (p->DataSize == 8 || p->DataSize == 0);
}

static err_t ReadData(ebml_date *Element, struct stream *Input, const ebml_parser_context *ParserContext, bool_t AllowDummyElt, int Scope, size_t DepthCheckCRC)
static err_t ReadData(ebml_date *Element, struct stream *Input, const ebml_parser_context *UNUSED_PARAM(ParserContext), bool_t UNUSED_PARAM(AllowDummyElt), int Scope, size_t UNUSED_PARAM(DepthCheckCRC))
{
err_t Result;
int DataSize;
Expand Down
6 changes: 3 additions & 3 deletions libebml2/ebmlelement.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static bool_t ValidateSize(const ebml_element *p)
return EBML_ElementIsFiniteSize(p); /* not allowed outside of master elements */
}

static void PostCreate(ebml_element *Element, bool_t SetDefault, int ForProfile)
static void PostCreate(ebml_element *Element, bool_t UNUSED_PARAM(SetDefault), int UNUSED_PARAM(ForProfile))
{
Element->DefaultSize = -1;
Element->ElementPosition = INVALID_FILEPOS_T;
Expand All @@ -30,7 +30,7 @@ static bool_t NeedsDataSizeUpdate(ebml_element *Element, bool_t bWithDefault)
return 1;
}

static filepos_t UpdateDataSize(ebml_element *Element, bool_t bWithDefault, bool_t bForceWithoutMandatory, int ForProfile)
static filepos_t UpdateDataSize(ebml_element *Element, bool_t bWithDefault, bool_t UNUSED_PARAM(bForceWithoutMandatory), int UNUSED_PARAM(ForProfile))
{
if (!bWithDefault && EBML_ElementIsDefaultValue(Element))
return 0;
Expand Down Expand Up @@ -124,7 +124,7 @@ filepos_t EBML_ElementFullSize(const ebml_element *Element, bool_t bWithDefault)
return Element->DataSize + GetIdLength(Element->Context->Id) + EBML_CodedSizeLength(Element->DataSize, Element->SizeLength, EBML_ElementIsFiniteSize(Element));
}

filepos_t EBML_ElementDataSize(const ebml_element *Element, bool_t bWithDefault)
filepos_t EBML_ElementDataSize(const ebml_element *Element, bool_t UNUSED_PARAM(bWithDefault))
{
return Element->DataSize;
}
Expand Down
Loading
Loading