-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Fixes for gcc4.4 #5384
Fixes for gcc4.4 #5384
Conversation
LGTM on changes ... wait to see if code works as expected. |
HAS_WORKING_SHADOW = $(shell $(CHECK_SHADOW_WORKS_CMD) 2> /dev/null && echo true || echo false) | ||
ifeq ($(HAS_WORKING_SHADOW),true) | ||
W_SHADOW=-Wshadow | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this one works as expected. For example the following code below always returns true with or without the shadow warning parameter:
$ `gcc -std=c99 -Werror -o /dev/null -c shadow.c 2> /dev/null` && echo true || echo false
true
$ `gcc -std=c99 -Werror -Wshadow -o /dev/null -c shadow.c 2> /dev/null` && echo true || echo false
true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of the check is to check to see if the compiler allows the shadow parameter in the expected way. The comparison would be to check the same command on gcc-4.4 vs gcc-4.8 or gcc-5.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just out of curiosity - and I'm sure you noticed something - but how might it behave differently among the versions? For example, in the manual for 5.3 you'll notice the following:
-Wshadow
Warn whenever a local variable or type declaration shadows another variable, parameter, type, class member (in C++), or instance variable (in Objective-C) or whenever a built-in function is shadowed. Note that in C++, the compiler warns if a local variable shadows an explicit typedef, but not if it shadows a struct/class/enum.
Usually if there was a difference among the versions, you would see something like this, specifying the version differences:
-Wpacked-bitfield-compat
The 4.1, 4.2 and 4.3 series of GCC ignore the packed attribute on bit-fields of type char. This has been fixed in GCC 4.4 but the change can lead to differences in the structure layout. GCC informs you when the offset of such a field has changed in GCC 4.4. For example there is no longer a 4-bit padding between field a and b in this structure:
struct foo
{
char a:4;
char b:8;
} __attribute__ ((packed));
This warning is enabled by default. Use -Wno-packed-bitfield-compat to disable this warning.
Thanks,
~p
Sorry for naive question, but what was broken before that this PR is fixing? It looks like some of the tests are failing :( |
Some of the tests appear to be failing because of an issue with the Jenkins workers at the time of this build. If you dig into the console output, you'll see that the tests are passing but there is a problem in report generation. The team is getting this back in order soon. |
Hi Vijay, I looked at the console output and I still see failures. The reports seem to be generated fine. If I go to the console output here: https://grpc-testing.appspot.com/job/gRPC_pull_requests/6447/console And then I go to one that shows failure I believe you are using the following HTML publisher, but the plugin is not what's generating the failure: https://github.com/jenkinsci/htmlpublisher-plugin So let's dig on this one a little deeper. If I go to the interop console: https://grpc-testing.appspot.com/job/gRPC_interop_pull_requests/2366/console And look specifically at the following error: [AR] Creating /var/local/git/grpc/tmp/x86_64-linux/grpc_c/2.1.5/libs/opt/libz.a
src/core/support/env_linux.c: In function 'gpr_getenv':
src/core/support/env_linux.c:64:5: error: implicit declaration of function 'strstr' [-Werror=implicit-function-declaration]
if (getenv_func != NULL && strstr(names[i], "secure") == NULL) {
^ This line point to line 64 of env_linux.c. This is usually due to not having $ cat string.h | grep strstr
extern char *strstr (char *__haystack, __const char *__needle)
__THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
extern __const char *strstr (__const char *__haystack,
__THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
strstr (char *__haystack, __const char *__needle) __THROW
return __builtin_strstr (__haystack, __needle);
strstr (__const char *__haystack, __const char *__needle) __THROW
return __builtin_strstr (__haystack, __needle);
extern char *strstr (__const char *__haystack, __const char *__needle)
/* Similar to `strstr' but this function ignores the case of both strings. */
$ But you have But if I look inside it there is not declaration of By any chance do you have the design specifications for gRPC that details the functionality and operations of the intended source code? With that it will make it straightforward to address all these issues. Thank you, |
Thanks for looking a little deeper. Yes, I was only looking at a few of them where the reports were getting stuck. The remaining failures will certainly need to be taken care of before merging. But in answer to your original question, the purpose of the PR is to resolve failures related to using this with gcc 4.4, which was triggering shadow warnings on the use of "index" and "close" in boringssl. |
@@ -69,6 +69,9 @@ RUN apt-get update && apt-get -y install libgtest-dev libc++-dev clang && apt-ge | |||
RUN apt-get update && apt-get -y install python-pip && apt-get clean | |||
RUN pip install argparse | |||
|
|||
RUN wget http:https://openssl.org/source/openssl-1.0.2f.tar.gz | |||
ADD post-git-setup.sh / |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With our setup, ADD is actually a bit dangerous. We currently name the docker image after building with a sha1 of the Dockerfile itself. So if you happen to update the post-git-setup.sh script later, that change will get picked up (I think), but concurrent runs of older and newer versions of our code will keep rewriting the dockerimage to use (and you'll never be sure which version you are actually running).
I reviewed the Docker and run_tests related part of the PR (see inline comments). Leaving review of makefile and C core changes to @vjpai (I did a quick pass I and I was basically happy about that part). |
@jtattermusch - Updated the docker stuff, PTAL |
LGTM, did it pass with gcc4.4 locally? |
Yeah. Just pushed a commit to fix the strstr problem when On Wed, Feb 24, 2016 at 3:49 PM Jan Tattermusch [email protected]
|
Thanks Craig :) |
Hi Vijay, It should be fairly simple to update $ cat shadow.c
int main(void) {
int i;
{ int i; }
}
$ gcc -Wshadow shadow.c
shadow.c: In function âmainâ:
shadow.c:5:8: warning: declaration of âiâ shadows a previous local [-Wshadow]
{ int i; }
^
shadow.c:3:6: warning: shadowed declaration is here [-Wshadow]
int i;
^
$ cat shadow-ignore.c
int main(void) {
#pragma GCC diagnostic ignored "-Wshadow"
int i;
#pragma GCC diagnostic ignored "-Wshadow"
{ int i; }
}
$ gcc -Wshadow shadow-ignore.c
$ Hope it helps, |
@vjpai is this fine to merge? |
No description provided.