Skip to content

Commit

Permalink
fix clang warnings and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rjonaitis committed Jul 9, 2024
1 parent 141d5e4 commit 7072fe9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 46 deletions.
2 changes: 1 addition & 1 deletion GUI/limeGUIFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ limeGUIFrame::limeGUIFrame(wxWindow* parent, const AppArgs& appArgs)
wxEVT_TREE_SEL_CHANGED, wxTreeEventHandler(limeGUIFrame::DeviceTreeSelectionChanged), this, deviceTree->GetId());

DeviceHandle handle;
uint32_t initialIndex;
uint32_t initialIndex{ 0 };
if (!appArgs.device.IsEmpty() && FoundDevice(appArgs.device, handle, initialIndex))
{
pnlDeviceConnection->SetSelection(initialIndex);
Expand Down
6 changes: 3 additions & 3 deletions GUI/oglGraph/GLFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ void GLFont::render_textWorldSpace(const char* text, float x, float y, float fon
}
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, 4 * sizeof(float), static_cast<char*>(nullptr));
glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), static_cast<char*>(nullptr) + 2 * sizeof(float));
glVertexPointer(2, GL_FLOAT, 4 * sizeof(float), static_cast<void*>(nullptr));
glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), reinterpret_cast<void*>(2 * sizeof(float)));
const char* p;
for (p = text; *p; ++p)
{
Expand Down Expand Up @@ -361,7 +361,7 @@ void GLFont::render_textScreenSpace(const char* text, float x, float y, float fo
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, 4 * sizeof(float), nullptr);
glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), static_cast<char*>(nullptr) + 2 * sizeof(float));
glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), reinterpret_cast<void*>(2 * sizeof(float)));
const char* p;
for (p = text; *p; ++p)
{
Expand Down
6 changes: 5 additions & 1 deletion external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if(TARGET OpenGL::GL) # GLEW header needs GL/gl.h
target_compile_definitions(GLEW PUBLIC GLEW_STATIC GLEW_NO_GLU)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(GLEW PRIVATE -Wno-address)
target_compile_options(GLEW PRIVATE -Wno-address -Wno-strict-prototypes)
endif()

# compile only when other targets link to it
Expand Down Expand Up @@ -66,6 +66,10 @@ if(NOT kissfft_POPULATED)
add_subdirectory(${kissfft_SOURCE_DIR} ${kissfft_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
set_property(TARGET kissfft PROPERTY POSITION_INDEPENDENT_CODE TRUE)
# disable warnings spam
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(kissfft PRIVATE -Wno-strict-prototypes -Wno-newline-eof -Wno-cast-align)
endif()
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_ORIG})

# Download easily downloadable header only ones
Expand Down
2 changes: 1 addition & 1 deletion src/boards/LMS7002M_SDRDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ OpStatus LMS7002M_SDRDevice::SetFrequency(uint8_t moduleIndex, TRXDir trx, uint8
int64_t oppositeDirLO = lms->GetFrequencySX(trx == TRXDir::Rx ? TRXDir::Tx : TRXDir::Rx);
OpStatus status = lms->SetFrequencySX(trx, frequency);
// Readback of LO frequency might not exactly match what was requested, so compare with some margin
bool useTDD = (abs(oppositeDirLO - frequency) <= 20);
bool useTDD = (std::abs(oppositeDirLO - frequency) <= 20);
lms->EnableSXTDD(useTDD);
return status;
}
Expand Down
42 changes: 3 additions & 39 deletions src/comms/PCIe/linux-kernel-module/litepcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ static void litepcie_dma_reader_stop(struct litepcie_device *s, int chan_num)
ClearDMAReaderCounters(dmachan);
}

void litepcie_stop_dma(struct litepcie_device *s)
static void litepcie_stop_dma(struct litepcie_device *s)
{
struct litepcie_dma_chan *dmachan;
for (int i = 0; i < s->channels; i++)
Expand Down Expand Up @@ -1364,43 +1364,7 @@ static void litepcie_free_chdev(struct litepcie_device *s)
}
}

/* from stackoverflow */
void __attribute__((format(scanf, 2, 3))) sfind(char *string, char *format, ...)
{
va_list arglist;

va_start(arglist, format);
vsscanf(string, format, arglist);
va_end(arglist);
}

struct revision {
int yy;
int mm;
int dd;
};

int compare_revisions(struct revision d1, struct revision d2)
{
if (d1.yy < d2.yy)
return -1;
else if (d1.yy > d2.yy)
return 1;

if (d1.mm < d2.mm)
return -1;
else if (d1.mm > d2.mm)
return 1;
else if (d1.dd < d2.dd)
return -1;
else if (d1.dd > d2.dd)
return 1;

return 0;
}
/* from stackoverflow */

void FreeIRQs(struct litepcie_device *device)
static void FreeIRQs(struct litepcie_device *device)
{
dev_info(&device->dev->dev, "FreeIRQs %i\n", device->irqs);
if (device->irqs <= 0)
Expand All @@ -1415,7 +1379,7 @@ void FreeIRQs(struct litepcie_device *device)
pci_free_irq_vectors(device->dev);
}

int AllocateIRQs(struct litepcie_device *device)
static int AllocateIRQs(struct litepcie_device *device)
{
struct pci_dev *dev = device->dev;
int irqs = pci_alloc_irq_vectors(dev, 1, 32, PCI_IRQ_MSI);
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/TxBufferManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ template<class T> class TxBufferManager
bytesUsed += sizeof(StreamHeader);
}
const uint32_t freeSpace = std::min(maxPayloadSize - payloadSize, mCapacity - bytesUsed - 16);
const uint32_t transferCount = std::min({ freeSpace / bytesForFrame, src->size(), maxSamplesInPkt });
const uint32_t transferCount = std::min(freeSpace / bytesForFrame, std::min(src->size(), maxSamplesInPkt));
if (transferCount > 0)
{
int samplesDataSize = Interleave(payloadPtr, src->front(), transferCount, conversion);
Expand Down

0 comments on commit 7072fe9

Please sign in to comment.