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

warning: "Function cannot return qualified void type 'volatile void'" #24

Closed
Coeur opened this issue Jun 21, 2017 · 3 comments
Closed

Comments

@Coeur
Copy link
Contributor

Coeur commented Jun 21, 2017

Xcode 8.3.3, using compiler default ([-std=gnu99]), is reporting me warnings for aes_via_ace.h:

Function cannot return qualified void type 'volatile void'

Stack Overflow got a specific question regarding volatile void in AES... with a direct link to aes_via_ace.h, and it says we should use __attribute__((noreturn)) void instead.

Yet, this step is only changing the warning to another one:

Function declared 'noreturn' should not return

The same StackOverflow thread is concerned that:

  • this code is insane
  • Declaring a function as doesn't return when it does return to convince the optimizer to do something specific is asking for trouble.
  • Extensive use of this technique is definitely discouraged. First, it depends on customization for each compiler. Second, it depends on those compilers not changing how they handle the 'no return' case. Third, it's potentially confusing to subsequent maintainers.

Finally, a comment reveals:

  • In later AES implementations, I haven't seen this sort of 'trick' used at all.

It was unspecified what are those later AES implementations. Could be any of those:

Would it be possible to get inspiration from those to get rid of the volatile void?

@BrianGladman
Copy link
Owner

The VIA ACE code hasn't changed for many years now and I no longer have the kit that is necessary to test any changes that I might make in this. I am hence reluctant to make changes unless someone with VIA ACE kit is willing to test any changes that are made. I would expect that removing the volatile keyword would be all that is needed. If you are not using VIA ACE and simply want to remove the warnings, you can turn VIA ACE support off in aesopt.h.

@Coeur
Copy link
Contributor Author

Coeur commented Jun 21, 2017

On, nice suggestion! So I just need to change:

#if 1 && defined( VIA_ACE_POSSIBLE ) && !defined( USE_VIA_ACE_IF_PRESENT )
#  define USE_VIA_ACE_IF_PRESENT
#endif

to:

#if 0 && defined( VIA_ACE_POSSIBLE ) && !defined( USE_VIA_ACE_IF_PRESENT )
#  define USE_VIA_ACE_IF_PRESENT
#endif

It does solve my warning issue, but can't be done as a build setting (i.e. I have to edit the file).

@BrianGladman
Copy link
Owner

The aesopt.h file (up to line 443) is intended to be edited by the user. As you can see if you look through it, this file contains a large number of user defined options that have to be set in order to obtain the optimum performance from the code.

Coeur added a commit to Coeur/minizip that referenced this issue Jun 21, 2017
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

No branches or pull requests

2 participants