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

Fix compilation warnings #11846

Merged
merged 3 commits into from
Jan 10, 2022
Merged

Conversation

vlvkobal
Copy link
Contributor

Summary

The PR fixes the following compilation warnings

sudo stop systemctl stop netdata; sudo rm -rf /var/cache/netdata/*; sudo rm -rf /var/log/netdata/*; sudo CFLAGS="-Og -ggdb -Wall -Wextra -Wformat-signedness -fno-omit-frame-pointer -fstack-protector-all -DNETDATA_INTERNAL_CHECKS=1 -D_FORTiFY_SOURCE=2 -DNETDATA_VERIFY_LOCKS=1" ./netdata-installer.sh --enable-plugin-nfacct --enable-plugin-freeipmi --disable-backend-kinesis --enable-backend-prometheus-remote-write --use-system-protobuf --disable-cloud --disable-go --disable-lto --dont-wait --dont-start-it
ml/ml-dummy.c: In function 'ml_get_host_info':
ml/ml-dummy.c:13:50: warning: control reaches end of non-void function [-Wreturn-type]
   13 | char *ml_get_host_info(RRDHOST *RH) { (void) RH; }
      |  

database/sqlite/sqlite_aclk_chart.c: In function 'queue_chart_to_aclk':
database/sqlite/sqlite_aclk_chart.c:977:33: warning: unused parameter 'st' [-Wunused-parameter]
  977 | int queue_chart_to_aclk(RRDSET *st)
      | 

database/sqlite/sqlite_aclk_alert.c:726:12: warning: 'have_recent_alarm' defined but not used [-Wunused-function]
  726 | static int have_recent_alarm(RRDHOST *host, uint32_t alarm_id, time_t mark)
      |   

and

sudo stop systemctl stop netdata; sudo rm -rf /var/cache/netdata/*; sudo rm -rf /var/log/netdata/*; sudo CFLAGS="-Og -ggdb -Wall -Wextra -Wformat-signedness -fno-omit-frame-pointer -fstack-protector-all -DNETDATA_INTERNAL_CHECKS=1 -D_FORTiFY_SOURCE=2 -DNETDATA_VERIFY_LOCKS=1" ./netdata-installer.sh --enable-plugin-nfacct --enable-plugin-freeipmi --disable-backend-kinesis --enable-backend-prometheus-remote-write --use-system-protobuf --disable-go --disable-lto --dont-wait --dont-start-it
aclk/legacy/aclk_rx_msgs.c: In function 'aclk_handle_cloud_request_v2':
aclk/legacy/aclk_rx_msgs.c:166:21: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]
  166 |     cloud_req->data = data;
      |     ~~~~~~~~~~~~~~~~^~~~~~

database/sqlite/sqlite_aclk_chart.c: In function 'aclk_send_chart_event':
database/sqlite/sqlite_aclk_chart.c:411:33: warning: 'last_timestamp' may be used uninitialized in this function [-Wmaybe-uninitialized]
  411 |             wc->chart_timestamp = last_timestamp;
      |             ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

There is also a warning in SQLite

database/sqlite/sqlite3.c: In function 'pager_playback':
database/sqlite/sqlite3.c:55579:5: warning: 'memset' writing 4 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
55579 |     memset(&zSuper[-4], 0, 4);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
database/sqlite/sqlite3.c:55561:21: note: destination object '*pPager.pTmpSpace' of size [0, 9223372036854775807]
55561 |     zSuper = &pPager->pTmpSpace[4];
      |  

but it is not fixed yet in SQLite 3.37.0.

Component Name

Anomaly detection, ACLK

Test Plan

Run Netdata build with the aforementioned options. Check if the warnings are gone except an SQLite's one.

underhood
underhood previously approved these changes Dec 1, 2021
thiagoftsm
thiagoftsm previously approved these changes Dec 2, 2021
Copy link
Contributor

@thiagoftsm thiagoftsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not have warnings using gcc (GCC) 11.2.0.

@vlvkobal
Copy link
Contributor Author

vlvkobal commented Jan 5, 2022

Rebased because of a merge conflict with #11841.

@vlvkobal vlvkobal requested review from underhood and thiagoftsm and removed request for vkalintiris January 5, 2022 08:51
Copy link
Contributor

@thiagoftsm thiagoftsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recompiled the PR after rebase and the final result is as expected, LGTM!

@vlvkobal vlvkobal merged commit 3ba9dc6 into netdata:master Jan 10, 2022
@vlvkobal vlvkobal deleted the fix-compilation-warnings branch January 10, 2022 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/aclk area/database area/ml Machine Learning Related Issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants