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 build warning when LOG_LEVEL < LOG_INFO_LEVEL #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ajaybhargav
Copy link

Compiler generate unused variable 'i' warning in mqtt_list_subscribe_topic when MQTT_LOG_LEVEL < MQTT_LOG_INFO_LEVEL.

@SL-RU
Copy link

SL-RU commented Feb 23, 2024

We cannot do that because this flag is not meant to be used in such way, MQTT_LOG_LEVEL is only for mqtt_log. It is better to do in such way to remove warning and not to not mix definitions:

int i = 0;
(void) i;

@ajaybhargav
Copy link
Author

yes that's another way to do it. independent of LOG setting. I will modify that and push again.

Compiler generate unused variable 'i' warning in mqtt_list_subscribe_topic
when MQTT_LOG_LEVEL < MQTT_LOG_INFO_LEVEL.

Signed-off-by: Ajay Bhargav <[email protected]>
@@ -1463,6 +1463,8 @@ int mqtt_publish(mqtt_client_t* c, const char* topic_filter, mqtt_message_t* msg
int mqtt_list_subscribe_topic(mqtt_client_t* c)
{
int i = 0;

(void) i; /* prevent compiler warning */
Copy link

Choose a reason for hiding this comment

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

Awesome!

Copy link

Choose a reason for hiding this comment

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

@jiejieTop approve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants