Skip to content

Fixing ODIN II and blifexplorer Compiler Warnings. #2549

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

Merged
merged 2 commits into from
May 16, 2024
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
24 changes: 11 additions & 13 deletions blifexplorer/src/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,25 +929,23 @@ void Container::showActivity()

void Container::getActivityInformation()
{
//right now it is a dummy function. the activity values are
//generated randomly
// Right now, it is a dummy function. The activity values are
// generated randomly.
QHash<QString, nnode_t *>::const_iterator blockIterator = odinTable.constBegin();

while(blockIterator != odinTable.constEnd()){
QString name = blockIterator.key();
LogicUnit* visNode = unithashtable[name];
//get all connections outgoing and advise them to
//represent the activity by color
QList<Wire*> outgoingWires = visNode->getOutCons();
foreach(Wire* wire, outgoingWires){
int act = qrand() % 255;
wire->setActivity(act);

}
QString name = blockIterator.key();
LogicUnit* visNode = unithashtable[name];
// Get all connections outgoing and advise them to
// represent the activity by color.
QList<Wire*> outgoingWires = visNode->getOutCons();
foreach(Wire* wire, outgoingWires){
int act = QRandomGenerator::global()->bounded(255); // Use QRandomGenerator
wire->setActivity(act);
}
++blockIterator;
}
}

/*---------------------------------------------------------------------------------------------
* (function: showSimulationStep)
*-------------------------------------------------------------------------------------------*/
Expand Down
18 changes: 9 additions & 9 deletions blifexplorer/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ void MainWindow::fontSizeChanged(const QString &)
*-------------------------------------------------------------------------------------------*/
void MainWindow::sceneScaleChanged(int scale)
{
double newScale = scale/100.0;
QMatrix oldMatrix = view->matrix();
view->resetMatrix();
view->translate(oldMatrix.dx(), oldMatrix.dy());
double newScale = scale / 100.0;
QTransform oldTransform = view->transform(); // Use transform() instead of matrix()
view->resetTransform(); // Changed from resetMatrix() to resetTransform()
view->translate(oldTransform.dx(), oldTransform.dy()); // Use dx() and dy() from QTransform
view->scale(newScale, newScale);
}

Expand Down Expand Up @@ -915,7 +915,7 @@ void MainWindow::openFileWithOdin(){
tr("Open BLIF"),
QDir::homePath(),
tr("BLIF files (*.blif);;All files (*.*)"),
0,
nullptr, // No parent,
QFileDialog::DontUseNativeDialog);

myContainer->setFilename(actBlifFilename);
Expand All @@ -925,10 +925,10 @@ void MainWindow::openFileWithOdin(){
//An error occured
QMessageBox msgBox(QMessageBox::Warning, tr("No Structure Found in File"),
"The file you tried to explore does not contain any structures or could not be opened. Please select another file."
, 0, this);
msgBox.addButton(tr("Open &Again"), QMessageBox::AcceptRole);
msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole);
if (msgBox.exec() == QMessageBox::AcceptRole)

, QMessageBox::Open | QMessageBox::Cancel, this);
msgBox.setDefaultButton(QMessageBox::Open);
if (msgBox.exec() == QMessageBox::Open)
openFileWithOdin();

}else{
Expand Down
16 changes: 8 additions & 8 deletions libs/libvqm/vqm_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ VQM_DLL_API t_module *vqm_parse_file(char *filename)

VQM_DLL_API int vqm_get_error_message(char *message_buffer, int length)
{
int result = -1;
int temp = strlen(most_recent_error);
int result = -1;
int temp = strlen(most_recent_error);

if (temp <= length)
{
strcpy(message_buffer, message_buffer);
result = temp;
}
return result;
if (temp < length) // Note: Changed to '<' to avoid buffer overflow
{
strcpy(message_buffer, most_recent_error); // Copy 'most_recent_error' to 'message_buffer'
result = temp;
}
return result;
}
6 changes: 3 additions & 3 deletions libs/libvqm/vqm_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ extern int yylex(void);

%union
{
uintptr_t value;
char *string;
uintptr_t value;
char *string;
}
%parse-param {t_parse_info* parse_info}
%error-verbose
%define parse.error verbose
/********************************************************/
/**** DEFINE TOKENS *************************************/
/********************************************************/
Expand Down
16 changes: 8 additions & 8 deletions odin_ii/src/ast/ast_loop_unroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,19 +312,18 @@ bool is_unsupported_post(ast_node_t* node, ast_node_t* symbol) {

post_condition_function resolve_binary_operation(ast_node_t* node) {
if (node->type == NUMBERS) {
return [=](long value) {
/*
* this lambda triggers a warning for unused variable unless
* we use value to generate a 0
*/
return node->types.vnumber->get_value() + (value - value);
return [=](long value) noexcept {
(void)value; // Indicate that value is unused
return node->types.vnumber->get_value();
};
} else if (node->type == IDENTIFIERS) {
return [=](long value) {
return [=](long value) noexcept {
(void)value; // Indicate that value is unused
return value;
};
} else {
return [=](long value) {
return [=](long value) noexcept {
(void)value; // Indicate that value is unused
post_condition_function left_func = resolve_binary_operation(node->children[0]);
post_condition_function right_func = resolve_binary_operation(node->children[1]);
switch (node->types.operation.op) {
Expand All @@ -343,6 +342,7 @@ post_condition_function resolve_binary_operation(ast_node_t* node) {
}
}


/*
* (function: resolve_post_condition)
* return a lambda which gives the next value
Expand Down
Loading