Skip to content

Commit 59c2105

Browse files
committed
Taking care of the warnings & added -Werror
1 parent 179eb8a commit 59c2105

File tree

6 files changed

+22
-15
lines changed

6 files changed

+22
-15
lines changed

include/skyline/nx/sf/cmif.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ typedef struct CmifResponse {
9292
} CmifResponse;
9393

9494
NX_CONSTEXPR void* cmifGetAlignedDataStart(u32* data_words, void* base) {
95-
intptr_t data_start = ((u8*)data_words - (u8*)base + 15) & ~15;
95+
intptr_t data_start = ((u8*)(void*)data_words - (u8*)(void*)base + 15) & ~15;
9696
return (u8*)base + data_start;
9797
}
9898

nso.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ INCLUDES := include libs/libeiffel/include
4242
#---------------------------------------------------------------------------------
4343
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec
4444

45-
CFLAGS := -g -Wall -ffunction-sections \
45+
CFLAGS := -g -Wall -Werror -ffunction-sections \
4646
$(ARCH) $(DEFINES)
4747

4848
CFLAGS += $(INCLUDE) -D__SWITCH__ -DCROSSVER=$(CROSSVER)

source/RegionalDialect/Hook.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ uintptr_t FindPattern(const unsigned char* dataStart,
235235
uintptr_t baseAddress, size_t offset, int occurrence) {
236236
// Build vectored pattern..
237237
vector<PatternByte> patterndata;
238-
if (!TransformPattern(pszPattern, patterndata)) return NULL;
238+
if (!TransformPattern(pszPattern, patterndata)) return 0;
239239

240240
// The result count for multiple results..
241241
int resultCount = 0;
@@ -259,7 +259,7 @@ uintptr_t FindPattern(const unsigned char* dataStart,
259259
break;
260260
}
261261

262-
return NULL;
262+
return 0;
263263
}
264264

265265
uintptr_t SigScanRaw(const char *pattern, size_t offset, int occurrence) {
@@ -279,7 +279,7 @@ uintptr_t SigScanRaw(const char *pattern, size_t offset, int occurrence) {
279279
}
280280

281281
skyline::logger::s_Instance->Log(" not found!\n");
282-
return NULL;
282+
return 0;
283283
}
284284

285285
uintptr_t SigScan(const char* category, const char* sigName) {
@@ -318,7 +318,7 @@ std::vector<uintptr_t> SigScanExhaust(const char *category, const char *sigName)
318318
}
319319

320320

321-
std::vector<uintptr_t> SigScanArray(const char *category, const char *sigName, bool exhaust = false) {
321+
std::vector<uintptr_t> SigScanArray(const char *category, const char *sigName, bool exhaust) {
322322
auto ret = std::vector<uintptr_t>();
323323

324324
if (!rd::config::config["gamedef"]["signatures"][category].has(sigName)){

source/RegionalDialect/Text.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ void processSc3TokenList(int xOffset, int yOffset,int lineLength,
192192
break;
193193
case 0x1E:
194194
sc3string++;
195+
// [[fallthrough]];
195196
case 0x1F:
196197
sc3string++;
197198
break;
@@ -349,17 +350,16 @@ void HandleTipsDataInit(ulong thread, unsigned short *addr1, unsigned short *add
349350
}
350351

351352
void HandleMESsetNGflag(int nameNewline, int rubyEnabled) {
352-
353353
auto isNGtop = [](unsigned short glyph)->bool {
354-
for (int i = 0; i < *MESngFontListTopNumPtr; i++) {
354+
for (uint32_t i = 0; i < *MESngFontListTopNumPtr; i++) {
355355
if (MESngFontListTop[i] == glyph)
356356
return true;
357357
}
358358
return false;
359359
};
360360

361361
auto isNGlast = [](unsigned short glyph)->bool {
362-
for (int i = 0; i < *MESngFontListLastNumPtr; i++) {
362+
for (uint32_t i = 0; i < *MESngFontListLastNumPtr; i++) {
363363
if (MESngFontListLast[i] == glyph)
364364
return true;
365365
}
@@ -370,7 +370,7 @@ void HandleMESsetNGflag(int nameNewline, int rubyEnabled) {
370370
return glyph < 0x8000 && !isNGtop(glyph) && !isNGlast(glyph);
371371
};
372372

373-
auto nextWord = [&isLetter](int &pos)->void {
373+
auto nextWord = [&isLetter](uint32_t &pos)->void {
374374
int wordLen = 0;
375375
while (pos < *MEStextDatNumPtr && isLetter(MEStext[pos])) {
376376
MEStextFl[pos] = wordLen == 0 ? 0x0A : 0x0B;
@@ -381,7 +381,7 @@ void HandleMESsetNGflag(int nameNewline, int rubyEnabled) {
381381

382382
int processingRuby = 0;
383383
int processingRubyText = 0;
384-
int pos = 0;
384+
uint32_t pos = 0;
385385

386386
const uint16_t nameStart = 0x8001;
387387
const uint16_t nameEnd = 0x8002;
@@ -451,12 +451,12 @@ void HandleMESsetNGflag(int nameNewline, int rubyEnabled) {
451451

452452
int lastLetter = 0;
453453

454-
for (int i = 0; i < *MEStextDatNumPtr; i++) {
454+
for (uint32_t i = 0; i < *MEStextDatNumPtr; i++) {
455455
if (MEStextFl[i] == 0x0B || MEStextFl[i] == 0x09) {
456456
lastLetter = i;
457457
}
458458
}
459-
for (int i = lastLetter; i < *MEStextDatNumPtr; i++) {
459+
for (uint32_t i = lastLetter; i < *MEStextDatNumPtr; i++) {
460460
if (MEStextFl[i] != 0x07) {
461461
MEStextFl[i] = 0x0B;
462462
}

source/skyline/inlinehook/And64InlineHook.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,15 @@ static void __fix_instructions(uint32_t* __restrict inprw, uint32_t* __restrict
496496
#define __page_size PAGE_SIZE
497497
#define __page_align(n) __align_up(static_cast<uintptr_t>(n), __page_size)
498498
#define __ptr_align(x) __ptr(__align_down(reinterpret_cast<uintptr_t>(x), __page_size))
499+
500+
#ifndef __align_up
499501
#define __align_up(x, n) (((x) + ((n)-1)) & ~((n)-1))
502+
#endif
503+
504+
#ifndef __align_down
500505
#define __align_down(x, n) ((x) & -(n))
506+
#endif
507+
501508
#define __countof(x) static_cast<intptr_t>(sizeof(x) / sizeof((x)[0])) // must be signed
502509
#define __atomic_increase(p) __sync_add_and_fetch(p, 1)
503510
#define __sync_cmpswap(p, v, n) __sync_bool_compare_and_swap(p, v, n)

source/skyline/plugin/PluginManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ namespace plugin {
207207
const PluginInfo* ret = nullptr;
208208
for (auto& plugin : m_pluginInfos) {
209209
void* module_start = (void*)plugin.Module.ModuleObject->module_base;
210-
void* module_end = module_start + plugin.Size;
210+
void* module_end = (void*)((uintptr_t)module_start + (uintptr_t)plugin.Size);
211211
if (module_start < addr && addr < module_end) {
212212
ret = &plugin;
213213
break;
@@ -225,6 +225,6 @@ void get_plugin_addresses(const void* internal_addr, void** start, void** end) {
225225
*start = *end = nullptr;
226226
else {
227227
*start = (void*)info->Module.ModuleObject->module_base;
228-
*end = *start + info->Size;
228+
*end = (void*)((uintptr_t)*start + (uintptr_t)info->Size);
229229
}
230230
}

0 commit comments

Comments
 (0)