Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
solidpixel committed Nov 14, 2024
1 parent 2c1b45a commit 5297af6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 10 deletions.
9 changes: 9 additions & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@ target_include_directories(
arm_gpuinfo PUBLIC
".")

target_compile_options(
arm_gpuinfo PRIVATE

-Wall
-Wextra
-Wpedantic
-Werror
-Wshadow)

install(TARGETS arm_gpuinfo DESTINATION ${PACKAGE_ROOT})
43 changes: 33 additions & 10 deletions source/libgpuinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

#include "libgpuinfo.hpp"

#define UNUSED(x) (void)x

namespace libarmgpuinfo {

struct product_entry {
Expand All @@ -62,6 +64,10 @@ static uint32_t get_num(
uint32_t core_features,
uint32_t thread_features
) {
UNUSED(core_count);
UNUSED(core_features);
UNUSED(thread_features);

return val;
}

Expand All @@ -70,6 +76,8 @@ static uint32_t get_num_eng_g31(
uint32_t core_features,
uint32_t thread_features
) {
UNUSED(core_features);

if ((core_count == 1) && ((thread_features & 0xFFFF) == 0x2000))
{
return 1;
Expand All @@ -83,6 +91,8 @@ static uint32_t get_num_eng_g51(
uint32_t core_features,
uint32_t thread_features
) {
UNUSED(core_features);

if ((core_count == 1) && ((thread_features & 0xFFFF) == 0x2000))
{
return 1;
Expand All @@ -96,6 +106,9 @@ static uint32_t get_num_eng_g52(
uint32_t core_features,
uint32_t thread_features
) {
UNUSED(core_count);
UNUSED(thread_features);

return core_features & 0xF;
}

Expand All @@ -104,6 +117,9 @@ static uint32_t get_num_fma_g510(
uint32_t core_features,
uint32_t thread_features
) {
UNUSED(core_count);
UNUSED(thread_features);

uint32_t variant = core_features & 0xF;
switch(variant)
{
Expand All @@ -126,6 +142,9 @@ static uint32_t get_num_tex_g510(
uint32_t core_features,
uint32_t thread_features
) {
UNUSED(core_count);
UNUSED(thread_features);

uint32_t variant = core_features & 0xF;
switch(variant)
{
Expand All @@ -148,6 +167,9 @@ static uint32_t get_num_pix_g510(
uint32_t core_features,
uint32_t thread_features
) {
UNUSED(core_count);
UNUSED(thread_features);

// This returns min(blend, pixel)
// Also limits to 2 for single engine configs
uint32_t variant = core_features & 0xF;
Expand All @@ -171,6 +193,9 @@ static uint32_t get_num_eng_g510(
uint32_t core_features,
uint32_t thread_features
) {
UNUSED(core_count);
UNUSED(thread_features);

uint32_t variant = core_features & 0xF;
switch(variant)
{
Expand Down Expand Up @@ -242,7 +267,7 @@ uint32_t get_gpu_id(

const char* get_gpu_name(
uint32_t gpu_id,
int core_count
uint32_t core_count
) {
for (const auto& entry : PRODUCT_VERSIONS)
{
Expand Down Expand Up @@ -271,7 +296,7 @@ const char* get_architecture_name(

int get_num_exec_engines(
uint32_t gpu_id,
int core_count,
uint32_t core_count,
uint32_t core_features,
uint32_t thread_features
) {
Expand All @@ -286,9 +311,9 @@ int get_num_exec_engines(
return 0;
}

const uint32_t get_num_fp32_fmas(
uint32_t get_num_fp32_fmas(
uint32_t gpu_id,
int core_count,
uint32_t core_count,
uint32_t core_features,
uint32_t thread_features
) {
Expand All @@ -304,9 +329,9 @@ const uint32_t get_num_fp32_fmas(
return 0;
}

const uint32_t get_num_texels(
uint32_t get_num_texels(
uint32_t gpu_id,
int core_count,
uint32_t core_count,
uint32_t core_features,
uint32_t thread_features
) {
Expand All @@ -321,9 +346,9 @@ const uint32_t get_num_texels(
return 0;
}

const uint32_t get_num_pixels(
uint32_t get_num_pixels(
uint32_t gpu_id,
int core_count,
uint32_t core_count,
uint32_t core_features,
uint32_t thread_features
) {
Expand Down Expand Up @@ -1136,8 +1161,6 @@ bool instance::init_props() {

/* See header for documentation */
bool instance::init_props_pre_r21() {
int error = 0;

kbase_pre_r21::uk_gpuprops_t props {};
props.header.id = kbase_pre_r21::header_id::get_props;
errno = 0;
Expand Down

0 comments on commit 5297af6

Please sign in to comment.