Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

ISO C forbids conversion of object pointer to function point

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
2 posts • Page 1 of 1
Author
Message
iTux
Guru
Guru
Posts: 586
Joined: Tue Sep 07, 2004 11:50 pm
Location: Toronto

ISO C forbids conversion of object pointer to function point

  • Quote

Post by iTux » Wed Dec 08, 2004 3:39 am

Hi,

I get serveral warnings with gcc 3.4.3 (on a PowerPC).

Any idea on how to modify the code to remove them?

Code: Select all

 gcc -DHAVE_CONFIG_H -I. -I. -I../../src/include -I./include -I./inlinability -Iinlinability -DBOOT_CLASS_PATH=\"/home/david/local/staging/share/sablevm-classpath:/home/david/local/staging/share/sablevm-classpath/libclasspath.jar:/home/david/local/staging/share/sablevm-classpath/resources.jar\" -DBOOT_LIBRARY_PATH=\"/home/david/local/staging/lib/sablevm-classpath\" -g -O2 -Wall -fno-gcse -fno-strict-aliasing -std=iso9899:1990 -pedantic -Werror -O0 -W -fno-builtin -Wshadow -Wpointer-arith -Wbad-function-cast -Wundef -Wcast-align -Wwrite-strings -Wsign-compare -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-long-long -MT libsablevm.lo -MD -MP -MF .deps/libsablevm.Tpo -c libsablevm.c  -fPIC -DPIC -o .libs/libsablevm.o
In file included from libsablevm.c:103:
native.c: In function `_svmf_bind_native_method':
native.c:607: warning: ISO C forbids conversion of object pointer to function pointer type
native.c:617: warning: ISO C forbids conversion of object pointer to function pointer type
In file included from invoke_interface.c:187,
                 from libsablevm.c:116:
vm_args.c: In function `JNI_CreateJavaVM':
vm_args.c:6: warning: ISO C forbids conversion of object pointer to function pointer type
vm_args.c:15: warning: ISO C forbids conversion of object pointer to function pointer type
vm_args.c:24: warning: ISO C forbids conversion of object pointer to function pointer type
In file included from libsablevm.c:120:
java_lang_VMRuntime.c: In function `Java_java_lang_VMRuntime_nativeLoad':
java_lang_VMRuntime.c:407: warning: ISO C forbids conversion of object pointer to function pointer type
make[5]: *** [libsablevm.lo] Error 1

This is the code that creates the warning. lt_dlsym returns a void *.

Code: Select all

	  method->data.native_method->code =
	    (void (*)(void)) lt_dlsym (native_library->handle,
				       method->data.native_method->
				       short_name);

Thanks,
iTux
Top
3lithium
n00b
n00b
Posts: 54
Joined: Sun Mar 07, 2004 5:51 pm
Contact:
Contact 3lithium
Website

  • Quote

Post by 3lithium » Wed Dec 08, 2004 6:12 am

It's a conflict between standards. For portability reasons, ISO C does not require that a void pointer can be cast to a function pointer (and vice versa). Conforming compilers are required to warn you about it if you try. dlsym() is however part of a standard (POSIX? SuSv3?) that requires such conversions to be meaningful.

You could use a union to get rid of the warning, but that would be a hack to hide the fact that the code is not portable C. I suggest that you either turn off or ignore the warning.
Top
Post Reply

2 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic