As far as I found in the documentation, and I have not completely exhausted my search, flag save the state of bits that set different flags, and then disable interrupts, and then restore their end. If interrupts were disabled by the first call to test , and then you make another call, I would assume (and it doesn't indicate anything that I found) that it will leave interrupts off, keep flags and restore them inside func() , and then restore them back to the flag state in test .
Interrupts should be re-enabled after the test function.
I would say that your only catch is that you cannot use the same flag variable in both functions, otherwise you will overwrite the first one in your internal call and then reset, and if any flags have changed between your calls You can reset the external to the wrong state.
source share