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

[swig] wrap logger.h #418

Merged
merged 4 commits into from
Nov 23, 2020
Merged

[swig] wrap logger.h #418

merged 4 commits into from
Nov 23, 2020

Conversation

qiluo-msft
Copy link
Contributor

Related to sonic-net/sonic-buildimage#5992
It turns out that we need to set log level in snmpagent repo.

common/logger.h Outdated
Comment on lines 134 to 137
#ifndef SWIG
[[ noreturn ]]
#endif
void settingThread();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit hard to read. Is there a way we could create a macro, e.g.,

#ifdef SWIG
#    define ATTRIBUTE_NORTEURN
#else
#    define ATTRIBUTE_NORTEURN [[ noreturn ]]
#endif

or

#ifdef SWIG
#    define ATTRIBUTE_NORTEURN
#else
#    define ATTRIBUTE_NORTEURN __declspec(noreturn)
#endif

Then use:

ATTRIBUTE_NORTEURN void settingThread();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback! Actually I found similar code in this file and followed. And positively testing GNU make more sense. Do you read better?


In reply to: 528070062 [](ancestors = 528070062)

Copy link
Contributor

@jleveque jleveque Nov 21, 2020

Choose a reason for hiding this comment

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

Sorry, but it's not much better. I was hoping to separate the #ifdef to a macro that can be reused so that this can become a one-line solution, e.g.,

ATTRIBUTE_NORTEURN void settingThread();

What makes it difficult to read is the fact that the attribute and the declaration are on different lines.

@qiluo-msft qiluo-msft merged commit f143b7f into sonic-net:master Nov 23, 2020
@qiluo-msft qiluo-msft deleted the qiluo/swiglog branch November 23, 2020 00:35
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.

3 participants