Commit Graph

115 Commits

Author SHA1 Message Date
Alex Lin
b60320464a Detect when TRICK_ICG is used in header files and compensate for it. #375
Always differences between clang versions.
2017-01-11 15:59:10 -06:00
Alex Lin
ba47c2048c Detect when TRICK_ICG is used in header files and compensate for it. #375
Created a hook for the clang preprocessor.  The hook does 2 things.  It
keeps track to which header files we have entered and exited.  Second it
searches for the use of TRICK_ICG.  If we find an instance of TRICK_ICG we
mark all of the included files from this point up the chain as requiring
compensation.  To compensate for using TRICK_ICG we write out the older
offset statements to get the location of variables in classes/structures.
2017-01-11 15:02:21 -06:00
Thadeus Fleming
fb1925e0d8 Use std::cerr instead of std::cout for error messages 2016-12-10 11:49:44 -06:00
Michael Vetter
18f0d7e871 Remove trailing whitespaces
Makes it easier to edit the files. So if we press 'end of line' we are
really at the end of line.
2016-11-08 10:25:07 +01:00
Alex Lin
d875f837f2 ICG produces non-compilable io_* code for this weird example #334
When saving the list of namespaces and classes a particular type is contained in
we have to save the class name and any template args it includes separately.  This
allows us to mangle the names easier.  And we now search for type names to see
if they follow this pattern template_name<template_args>::embedded_class.  If
we are using a template embedded class we need to create attributes for the embedded class.
2016-11-02 13:56:40 -05:00
Derek Bankieris
664797e391 Move one-time-use variables into their call site #341 2016-10-31 10:00:48 -05:00
Derek Bankieris
29b0d2d223 Alex doesn't like auto #341
Granted, there are times you shouldn't hide the type.
2016-10-31 09:51:44 -05:00
Derek Bankieris
5898f3fdec Improve loop efficiency #341
Calling getTemplateArgs() every iteration is wasteful. This should
be done once outside of the loop. Even better, use a foreach loop and
get rid of the index varible!
2016-10-31 09:34:24 -05:00
Derek Bankieris
bdcfbb4e3a Restore debug functions #341 2016-10-31 09:10:33 -05:00
Derek Bankieris
ef1405c3be Refactor ICG
Hey buddy. I wanted to tell you this before you heard it from someone
else...

I refactored ICG.

Now, it's gonna look a little scary at first. But I promise you'll like
it when you get used to it. It'll be fine. You can trust me. #341
2016-10-28 14:37:12 -05:00
Alex Lin
ba75f6ff37 ICG does not compile using llvm 3.9 #339
The call getRBraceLoc to find the ending source location of things is gone.  Replaced
it with getting the source range and get the end of that range.  Also the way to
get clang/llvm 3.9 to process c++11 code required some reordering of calls in main as
well as adding some more features to be turned on.
2016-10-28 13:21:21 -05:00
Derek Bankieris
0ba68e40aa Merge branch 'master' of https://github.com/nasa/trick
Conflicts:
	trick_source/codegen/Interface_Code_Gen/main.cpp
2016-10-21 15:15:41 -05:00
Derek Bankieris
015965abab Renamed most variabes so that they are self-descriptive. Stop using abbreviations! No one can tell what anything is.
Applied a consistent formatting.
Inlined several one-off variables.
2016-10-21 15:06:44 -05:00
Derek Bankieris
108d3d40c5 Added a version of almostRealPath that takes a const std::string& parameter so we don't have to use c_str() everywhere 2016-10-21 15:06:35 -05:00
Derek Bankieris
75c35752d6 Spacing 2016-10-21 15:05:26 -05:00
Alex Lin
a2452aacd0 ICG creates offsetof statements that will not compile when using clang #327
When copying inherited variables to a child class in ICG, the inherited flags
were not being set on the mac.
2016-10-21 13:13:43 -05:00
Alex Lin
f1cbacd646 ICG exclude of class member variables now defines incorrect memory offsets in io_src #311
This changes back the default behavior to not use offsetof in io_src code.
Added a flag to ICG, -c or --compat15, to globally generate offsetof statements.
Added an ENV variable that can be used to generate offsetof statements by file or directory.
Added in a warning if classes parsed at ICG time are different in size than at runtime.
2016-10-21 13:13:43 -05:00
Derek Bankieris
bcb421678a Fix spacing. Move declaration of loop variable into loop initializer. Rename stupid 1337 variable. 2016-10-21 10:49:11 -05:00
Derek Bankieris
2279ba8648 Restore print out when compiling io_* files #326 2016-10-21 09:20:50 -05:00
Derek Bankieris
4f49460a6f Clean up io_* code #330 2016-10-20 14:55:00 -05:00
Derek Bankieris
beb93f7e88 Removed useless local alias, eliminating the need to silence set but unused variable warnings #326 2016-10-20 14:55:00 -05:00
Derek Bankieris
2fb06cf133 Got rid of the individual io, py, and model conglomerate objects #326
Link all of the objects as part of the S_MAIN target using the link lists.
Renamed some variables and files to make them more self-descriptive.
2016-10-18 13:06:42 -05:00
Alex Lin
23af89681e ICG creates offsetof statements that will not compile when using clang #327
Added a check that was in 15 that tested the platform we are running on.  If we
are on an mac, we want to skip fully qualifying variable names because it creates
code that doesn't compile under clang.
2016-10-12 13:34:04 -05:00
Derek Bankieris
054245f968 Forgot to remove this debugging print out before the last commit 2016-10-06 14:28:06 -05:00
Derek Bankieris
f161ddb18c Made everything about Trick's build process better 2016-10-06 13:54:06 -05:00
Alex Lin
bbba26e057 Merge branch '17.0' 2016-09-16 09:50:12 -05:00
Alex Lin
00a0e8be44 ICG exclude of class member variables now defines incorrect memory offsets in io_src #311
Missed some bitfield offset calculations.
2016-09-16 09:46:03 -05:00
Alex Lin
c134ffea8f Merge branch '17.0' 2016-09-16 08:43:47 -05:00
Alex Lin
ae07b26243 ICG exclude of class member variables now defines incorrect memory offsets in io_src #311
Added back the code that set the offset of variables with the offsetof function. This
code is running by default.  Any code that includes #ifndef TRICK_ICG in
classes/structures will want this on.

Added a flag to ICG that allows us to turn off writing of these lines.  If the flag
is present, ICG may write out io_src code for private/protected variables that it could
not reach if an offsetof function was required.  Code cannot have any #ifndef TRICK_ICG
present in classes/structures for this to work.
2016-09-16 08:39:37 -05:00
Alex Lin
b2432fd269 Trickified Project Libraries #309
We were ignoring classes completely if it was found in to be in an external library
directory.  We need to partially process it so it is included in the ICG generated
class_map file which registers attributes of classes and eventually works it's way
to populating the S_sie file.
2016-09-15 14:48:23 -05:00
Alex Lin
9801e3d210 ICG not setting default checkpointing io correctly. #308
If a checkpoint_io field is found we were or'ing this in to bits already
set by default.  Clear the bits first.
2016-09-14 09:38:28 -05:00
Alex Lin
256c83a876 ICG not setting default checkpointing io correctly. #308
Changed the default io value from 3 which left out checkpointing to 15 which does
include checkpointing.
2016-09-13 16:37:59 -05:00
Alex Lin
919a8e2068 Variable using an enumeration as array index causes infinite loop #299
Once we determine the type of a variable we should stop processing the
AST tree at that point. We do this for record types but not for the
built in types.  Changed the return value of the process builtin
function to false so we stop processing.
2016-09-01 16:06:33 -05:00
Alex Lin
858602fe01 New STL framework doesn't support const #293
So using consts as arguments to STLs causes errors in our io code and SWIG.
Added a check for const template arguments and going to ignore them for
both ICG and what we input to SWIG.
2016-08-25 08:42:43 -05:00
Alex Lin
82049ead95 Add a printout when ICG parses header file with no Trick header comment #281
Added the printout.
2016-08-19 10:04:42 -05:00
Alex Lin
b26fcf2f3b Swap order of libraries during ICG linking. #277
Order swapped.
2016-08-03 09:03:41 -05:00
Alex Lin
89fda63293 Remove doxygen documentation now housed on wiki #189
moved all of the design documentation to the wiki
2016-08-02 17:50:49 -05:00
Alex Lin
ca02209d8f man pages completely out of date #253
Created man pages for each executable we have in bin.  Updated the
couple of man pages we did have in there.  Modified trick-CP
to accept arguments.  Updated the version number reported by ICG
as well.
2016-08-02 09:56:43 -05:00
Alex Lin
f7d1ff6376 ICG fails to compile on Mac when using clang/llvm 3.8.1. #271
Modified the makefile to define LIBCLANG_MAJOR, LIBCLANG_MINOR, and
LIBCLANG_PATCHLEVEL based on the llvm-config executable in the llvm
directory pointed to by the configuration.  These new variable names
are independent of the __clang_major__, etc. variables we were defining
only in Linux.  Using these names, we can reduce the clang version
checks to a single consistent set of version numbers.  We don't have
to deal with the different version numbers assigned by Apple.
2016-07-25 14:57:07 -05:00
Alex Lin
6e5beec9e1 Support clang releases that do not define a patchlevel.
Modified the makefile that creates the __clang_patchlevel__ define to
only create the variable if it is present in the clang version.

refs #266
2016-07-06 15:04:15 -05:00
Alex Lin
1731390c98 Switch compilation of ICG from clang++ to g++
Removed the lines that set the compiler to clang++, defaulting
it to g++.  Added lines in the makefile to set __clang_major__,
__clang_minor__, and __clang_patchlevel__.  These are required
to compile several of the files in the ICG directory.

refs #259
2016-06-29 17:33:04 -05:00
Alex Lin
1224c43e7f Set and use LD in our makefiles correctly.
Set LD in our makefiles to the ld executable found by configure.
Changed the final sim link to use TRICK_CPPC as the link command since
it was using the compiler anyways.  Changed the places where we use "ld" to
use LD.

refs #131
2016-06-27 12:48:35 -05:00
Alex Lin
fcb63e0e06 Output "--" if that was specified in the header file.
Used the mods field in the attributes to indicate of "--" was specified in the header file.  We
still save the units as "1" to keep it compatible with udunits.  When outputting the variable
in data recording or variable server we check to see if the mods field for "--" is set.  We
output "--" if the mods field is set.  Also allowed "--" to persist in data products.

refs #254
2016-06-21 16:12:28 -05:00
Alex Lin
c9e3bc77da er7_util header files not being installed
Added a makefile install rule to copy the header files out of
er7_utils to the install directory.  Adjusted ICG to ignore
Trick header files if they are installed.

refs #246
2016-06-20 13:40:45 -05:00
John M. Penn
af8548ce6a Exclude /sw (Fink directories from being processed by ICG. Refs#248 2016-06-10 14:52:19 -05:00
Alex Lin
1615e0f13b ICG should ignore FILE * variables
In ICG if we encounter a FILE * variable, we ignore it setting the IO specification to 0.

refs #244
2016-06-02 08:50:18 -05:00
Alex Lin
3e82f79f28 Use udunits package for units conversions.
FieldDescription.cpp is missing and include for stack.  Strange it compiles
on most platforms.

refs #231
2016-05-18 08:26:14 -05:00
Alex Lin
929372e863 Use udunits package for units conversions
Created a UDUNITS_LDFLAGS to store an link library path and -luduints2.

refs #231
2016-05-11 14:43:53 -05:00
Alex Lin
01fd86a513 Use udunits package for units conversions
Needed to add UDUNITS_INCLUDES to the ICG makefile and remove
the hardcoded udunits include path

refs #231
2016-05-11 11:27:39 -05:00
Alex Lin
26cb44e946 Use udunits package for units conversions
So our unit tests did their job, they pointed to quite a few errors.
Fixed them all on my platform (CentOS 7).

refs #231
2016-05-11 09:01:54 -05:00