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

Remove use of STATIC macros from EDK II C Coding Standard Specification (Bugzilla Bug 1766) #21

Open
tianocore-issues opened this issue Apr 29, 2019 · 8 comments

Comments

@tianocore-issues
Copy link

This issue was created automatically with bugzilla2github

Bugzilla Bug 1766

Date: 2019-04-29T12:27:36+00:00
From: @mdkinney
To: @changab
CC: @lgao4, @bexcran, yonghong.zhu

Blocker for: #1767
Last updated: 2023-05-06T05:53:46+00:00

@tianocore-issues
Copy link
Author

Comment 7341

Date: 2019-04-29 12:27:36 +0000
From: @mdkinney

  • Industry Specification: ---
  • Release Observed: EDK II Master
  • Releases to Fix: EDK II Master
  • Target OS: ---
  • Bugzilla Assignee(s): @changab

Update EDK II C Coding Standard Specification to remove the use of STATIC macros. Instead, the standard C syntax of 'static' should be used.

This macro was introduced a long time ago so it could be overloaded to other value to help with debugging. These debugging issues are not an issue anymore with the supported toolchains, so this document should recommend the use of the standard C syntax.

@tianocore-issues
Copy link
Author

Comment 7343

Date: 2019-04-29 12:43:47 +0000
From: @mdkinney

Also add recommendations on when to use 'static'.

There is feedback in the email thread above that compilers/linkers can
produce more efficient code if 'static' is used more aggressively.

Another advantage of using 'static' for global variables that are scoped
to a single file is to prevent name collisions between modules and libraries.

Add recommendations to the EDK II C Coding Standards Specification to use
'static' for all functions and global variables that are not referenced
outside the current C file.

@tianocore-issues
Copy link
Author

Comment 7453

Date: 2019-05-08 23:04:26 +0000
From: Yonghong Zhu <<yonghong.zhu>>

Mike, please help on it. thanks.

@tianocore-issues
Copy link
Author

Comment 14540

Date: 2020-12-09 15:36:56 +0000
From: @bexcran

Has the problem of debuggers not coping with static functions been fixed?

@tianocore-issues
Copy link
Author

Comment 14541

Date: 2020-12-09 15:38:40 +0000
From: @bexcran

Using static instead of STATIC would conflict with the rule about not using C types.

@tianocore-issues
Copy link
Author

Comment 20038

Date: 2022-11-15 22:08:32 +0000
From: @lgao4

Abner will update it.

@tianocore-issues
Copy link
Author

Comment 20062

Date: 2022-11-18 22:26:22 +0000
From: @changab

Remove the entire 5.4.2.2 section. We are not allowed to use upper-case STAIC in the source file now. Just follow C standard and use the lower-case 'static'.

@tianocore-issues
Copy link
Author

Comment 21501

Date: 2023-05-06 05:53:46 +0000
From: @bexcran

There are still several locations that need updated. In addition, I seem to recall a decision to allow use of static functions.

5.4.2.2 Static
An object declared STATIC has either file or block scope

5.4.2.2.2 Functions should not be declared STATIC.
Some source-level debuggers are unable to resolve static functions. Until it can be verified that no one
is dependent upon a debugger with this limitation, it is strongly recommended that functions not be
declared static.

5.6.1.2 The use of int, unsigned, char, void, static, long is a violation
of the coding convention.

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

No branches or pull requests

1 participant