Tobias Pape uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-topa.2342.mcz ==================== Summary ==================== Name: VMMaker.oscog-topa.2342 Author: topa Time: 6 March 2018, 3:03:51.335169 am UUID: fea20583-2134-4dfa-bd3a-aa47504642a5 Ancestors: VMMaker.oscog-akg.2341 The config should always come first. =============== Diff against VMMaker.oscog-akg.2341 =============== Item was changed: ----- Method: VMPluginCodeGenerator>>emitCHeaderOn: (in category 'C code generator') ----- emitCHeaderOn: aStream "Write a C file header onto the given stream." aStream nextPutAll: (self fileHeaderVersionStampForSourceClass: pluginClass). aStream cr; cr. #('<math.h>' '<stdio.h>' '<stdlib.h>' '<string.h>' '<time.h>') reverseDo: [:hdr| self addHeaderFileFirst: hdr]. + self addHeaderFileFirst: '"config.h"'. "Should always go first" "Additional header files; include C library ones first." self emitHeaderFiles: (headerFiles select: [:hdr| hdr includes: $<]) on: aStream. aStream cr; nextPutAll:'/* Default EXPORT macro that does nothing (see comment in sq.h): */ #define EXPORT(returnType) returnType /* Do not include the entire sq.h file but just those parts needed. */ #include "sqConfig.h" /* Configuration options */ #include "sqVirtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 #define false 0 #define null 0 /* using ''null'' because nil is predefined in Think C */ #ifdef SQUEAK_BUILTIN_PLUGIN # undef EXPORT # define EXPORT(returnType) static returnType #endif'; cr; cr. self addHeaderFile: '"sqMemoryAccess.h"'. "Additional header files; include squeak VM ones last" self emitHeaderFiles: (headerFiles reject: [:hdr| hdr includes: $<]) on: aStream. self maybePutPreambleFor: pluginClass on: aStream. aStream cr! |
If someone could translate the source and commit it, I shall be very thankful :) Best regards -Tobias > On 06.03.2018, at 03:04, [hidden email] wrote: > > > Tobias Pape uploaded a new version of VMMaker to project VM Maker: > http://source.squeak.org/VMMaker/VMMaker.oscog-topa.2342.mcz > > ==================== Summary ==================== > > Name: VMMaker.oscog-topa.2342 > Author: topa > Time: 6 March 2018, 3:03:51.335169 am > UUID: fea20583-2134-4dfa-bd3a-aa47504642a5 > Ancestors: VMMaker.oscog-akg.2341 > > The config should always come first. > > =============== Diff against VMMaker.oscog-akg.2341 =============== > > Item was changed: > ----- Method: VMPluginCodeGenerator>>emitCHeaderOn: (in category 'C code generator') ----- > emitCHeaderOn: aStream > "Write a C file header onto the given stream." > > aStream nextPutAll: (self fileHeaderVersionStampForSourceClass: pluginClass). > aStream cr; cr. > > #('<math.h>' '<stdio.h>' '<stdlib.h>' '<string.h>' '<time.h>') reverseDo: > [:hdr| self addHeaderFileFirst: hdr]. > + self addHeaderFileFirst: '"config.h"'. "Should always go first" > > "Additional header files; include C library ones first." > self emitHeaderFiles: (headerFiles select: [:hdr| hdr includes: $<]) on: aStream. > > aStream cr; nextPutAll:'/* Default EXPORT macro that does nothing (see comment in sq.h): */ > #define EXPORT(returnType) returnType > > /* Do not include the entire sq.h file but just those parts needed. */ > #include "sqConfig.h" /* Configuration options */ > #include "sqVirtualMachine.h" /* The virtual machine proxy definition */ > #include "sqPlatformSpecific.h" /* Platform specific definitions */ > > #define true 1 > #define false 0 > #define null 0 /* using ''null'' because nil is predefined in Think C */ > #ifdef SQUEAK_BUILTIN_PLUGIN > # undef EXPORT > # define EXPORT(returnType) static returnType > #endif'; cr; cr. > self addHeaderFile: '"sqMemoryAccess.h"'. > "Additional header files; include squeak VM ones last" > self emitHeaderFiles: (headerFiles reject: [:hdr| hdr includes: $<]) on: aStream. > self maybePutPreambleFor: pluginClass on: aStream. > aStream cr! > |
Hi Tobias, but why? Including configuration.h before including platform files can do nothing to modify those platform files, and can do nothing to modify their effects. But including it after can at least modify their effects. Can you explaining n why you want to include config.h before the platform includes? _,,,^..^,,,_ (phone) > On Mar 5, 2018, at 6:06 PM, Tobias Pape <[hidden email]> wrote: > > > If someone could translate the source and commit it, I shall be very thankful :) > > Best regards > -Tobias > >> On 06.03.2018, at 03:04, [hidden email] wrote: >> >> >> Tobias Pape uploaded a new version of VMMaker to project VM Maker: >> http://source.squeak.org/VMMaker/VMMaker.oscog-topa.2342.mcz >> >> ==================== Summary ==================== >> >> Name: VMMaker.oscog-topa.2342 >> Author: topa >> Time: 6 March 2018, 3:03:51.335169 am >> UUID: fea20583-2134-4dfa-bd3a-aa47504642a5 >> Ancestors: VMMaker.oscog-akg.2341 >> >> The config should always come first. >> >> =============== Diff against VMMaker.oscog-akg.2341 =============== >> >> Item was changed: >> ----- Method: VMPluginCodeGenerator>>emitCHeaderOn: (in category 'C code generator') ----- >> emitCHeaderOn: aStream >> "Write a C file header onto the given stream." >> >> aStream nextPutAll: (self fileHeaderVersionStampForSourceClass: pluginClass). >> aStream cr; cr. >> >> #('<math.h>' '<stdio.h>' '<stdlib.h>' '<string.h>' '<time.h>') reverseDo: >> [:hdr| self addHeaderFileFirst: hdr]. >> + self addHeaderFileFirst: '"config.h"'. "Should always go first" >> >> "Additional header files; include C library ones first." >> self emitHeaderFiles: (headerFiles select: [:hdr| hdr includes: $<]) on: aStream. >> >> aStream cr; nextPutAll:'/* Default EXPORT macro that does nothing (see comment in sq.h): */ >> #define EXPORT(returnType) returnType >> >> /* Do not include the entire sq.h file but just those parts needed. */ >> #include "sqConfig.h" /* Configuration options */ >> #include "sqVirtualMachine.h" /* The virtual machine proxy definition */ >> #include "sqPlatformSpecific.h" /* Platform specific definitions */ >> >> #define true 1 >> #define false 0 >> #define null 0 /* using ''null'' because nil is predefined in Think C */ >> #ifdef SQUEAK_BUILTIN_PLUGIN >> # undef EXPORT >> # define EXPORT(returnType) static returnType >> #endif'; cr; cr. >> self addHeaderFile: '"sqMemoryAccess.h"'. >> "Additional header files; include squeak VM ones last" >> self emitHeaderFiles: (headerFiles reject: [:hdr| hdr includes: $<]) on: aStream. >> self maybePutPreambleFor: pluginClass on: aStream. >> aStream cr! >> > |
> On 06.03.2018, at 05:59, Eliot Miranda <[hidden email]> wrote: > > > Hi Tobias, > > but why? Including configuration.h before including platform files can do nothing to modify those platform files, and can do nothing to modify their effects. But including it after can at least modify their effects. Can you explaining n why you want to include config.h before the platform includes? Because config.h properly defines flags. One of those is _GNU_SOURCE, as explained in https://www.gnu.org/software/autoconf/manual/autoconf.html#Posix-Variants Where the Autoconf macro AC_USE_SYSTEM_EXTENSIONS makes sure this is defined. However, This must be one of the first things to define. Also, I don't really see how the config.h (Either here https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/unix/config/config.h.in or in my branch https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/krono/openbsd/platforms/unix/config/config.h.in ) could alter anything AFTER system headers have been included. Those "#undef"s will be changed to "#define"s if the proper measures took place. In fact, it has to be the other way round, because config.h is also there to determine whether a system header is available in the first place. For example, the system header sys/time.h is known not to be present everywhere. (see https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/krono/openbsd/platforms/unix/config/config.h.in#L209 ) So the pattern here is: =-=-=-=-=-=-= myfile.c #include "config.h" #if defined(HAVE_SYS_TIME_H) #include <sys/time.h> #endif =-=-=-=-=-=-= configure.ac (eg https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/unix/config/configure.ac#L237) AC_HEADER_TIME =-=-=-=-=-= Note that this is well documented for autoconf, eg especially things like time.h: https://www.gnu.org/software/autoconf/manual/autoconf.html#index-AC_005fHEADER_005fTIME-654 But this is also true for all other HAVE_*_H in config.h{.in}, of which we actually already have a whooping 21 entries: #undef HAVE_INTERP_H #undef HAVE_UNISTD_H #undef HAVE_DIRENT_H #undef HAVE_SYS_NDIR_H #undef HAVE_SYS_DIR_H #undef HAVE_NDIR_H #undef HAVE_DLFCN_H #undef HAVE_ICONV_H #undef HAVE_SYS_TIME_H #undef HAVE_SYS_FILIO_H #undef HAVE_SYS_AUDIOIO_H #undef HAVE_SUN_AUDIOIO_H #undef HAVE_PTY_H #undef HAVE_UTIL_H #undef HAVE_LIBUTIL_H #undef HAVE_STROPTS_H #undef HAVE_GL_GL_H #undef HAVE_OPENGL_GL_H #undef NEED_SUNOS_H #undef HAVE_ALLOCA_H #undef HAVE_FEATURES_H =-=-=-= To come back to _GNU_SOURCE, this must be defined before including any system header, as it actually is checked the first time <features.h> is include, which every system header does. Including config.h after any system header has no effect whatsoever. Best regards -Tobias > > _,,,^..^,,,_ (phone) > >> On Mar 5, 2018, at 6:06 PM, Tobias Pape <[hidden email]> wrote: >> >> >> If someone could translate the source and commit it, I shall be very thankful :) >> >> Best regards >> -Tobias >> >>> On 06.03.2018, at 03:04, [hidden email] wrote: >>> >>> >>> Tobias Pape uploaded a new version of VMMaker to project VM Maker: >>> http://source.squeak.org/VMMaker/VMMaker.oscog-topa.2342.mcz >>> >>> ==================== Summary ==================== >>> >>> Name: VMMaker.oscog-topa.2342 >>> Author: topa >>> Time: 6 March 2018, 3:03:51.335169 am >>> UUID: fea20583-2134-4dfa-bd3a-aa47504642a5 >>> Ancestors: VMMaker.oscog-akg.2341 >>> >>> The config should always come first. >>> >>> =============== Diff against VMMaker.oscog-akg.2341 =============== >>> >>> Item was changed: >>> ----- Method: VMPluginCodeGenerator>>emitCHeaderOn: (in category 'C code generator') ----- >>> emitCHeaderOn: aStream >>> "Write a C file header onto the given stream." >>> >>> aStream nextPutAll: (self fileHeaderVersionStampForSourceClass: pluginClass). >>> aStream cr; cr. >>> >>> #('<math.h>' '<stdio.h>' '<stdlib.h>' '<string.h>' '<time.h>') reverseDo: >>> [:hdr| self addHeaderFileFirst: hdr]. >>> + self addHeaderFileFirst: '"config.h"'. "Should always go first" >>> >>> "Additional header files; include C library ones first." >>> self emitHeaderFiles: (headerFiles select: [:hdr| hdr includes: $<]) on: aStream. >>> >>> aStream cr; nextPutAll:'/* Default EXPORT macro that does nothing (see comment in sq.h): */ >>> #define EXPORT(returnType) returnType >>> >>> /* Do not include the entire sq.h file but just those parts needed. */ >>> #include "sqConfig.h" /* Configuration options */ >>> #include "sqVirtualMachine.h" /* The virtual machine proxy definition */ >>> #include "sqPlatformSpecific.h" /* Platform specific definitions */ >>> >>> #define true 1 >>> #define false 0 >>> #define null 0 /* using ''null'' because nil is predefined in Think C */ >>> #ifdef SQUEAK_BUILTIN_PLUGIN >>> # undef EXPORT >>> # define EXPORT(returnType) static returnType >>> #endif'; cr; cr. >>> self addHeaderFile: '"sqMemoryAccess.h"'. >>> "Additional header files; include squeak VM ones last" >>> self emitHeaderFiles: (headerFiles reject: [:hdr| hdr includes: $<]) on: aStream. >>> self maybePutPreambleFor: pluginClass on: aStream. >>> aStream cr! >>> >> |
Also, > On 06.03.2018, at 09:42, Tobias Pape <[hidden email]> wrote: > > > Those "#undef"s will be changed to "#define"s if the proper measures took place. I forgot to say that if one tries to do something with those macros before including config.h, things might not go as planned. 1. if system header says #define X and config.h says #undef X, it is not available. (maybe ok) 2. if system header does not say #define X and config.h says #undef X, nothing happen. (ok) 3. if system header says #define X and config.h says #define X you get an error because X is already defined (Not ok) 4. if system header does not say #define X and config.h says #define X, you may get undesired behavior (maybe not ok). Best regards -Tobias |
Free forum by Nabble | Edit this page |