sim: profile: fix building with --disable-sim-profile
authorMike Frysinger <vapier@gentoo.org>
Tue, 23 Nov 2010 02:48:54 +0000 (02:48 +0000)
committerMike Frysinger <vapier@gentoo.org>
Tue, 23 Nov 2010 02:48:54 +0000 (02:48 +0000)
When the sim is configured with profile support disabled, the build fails:
./../common/sim-profile.c: In function 'profile_option_handler':
./../common/sim-profile.c:337:6: warning: implicit declaration of function 'PROFILE_PC_FREQ'
./../common/sim-profile.c:337:6: error: lvalue required as left operand of assignment
./../common/sim-profile.c:351:6: warning: implicit declaration of function 'PROFILE_PC_NR_BUCKETS'
./../common/sim-profile.c:351:6: error: lvalue required as left operand of assignment
./../common/sim-profile.c:381:6: warning: implicit declaration of function 'PROFILE_PC_SHIFT'
./../common/sim-profile.c:381:6: error: lvalue required as left operand of assignment
./../common/sim-profile.c:405:8: warning: implicit declaration of function 'PROFILE_PC_START'
./../common/sim-profile.c:405:8: error: lvalue required as left operand of assignment
./../common/sim-profile.c:406:8: warning: implicit declaration of function 'PROFILE_PC_END'
./../common/sim-profile.c:406:8: error: lvalue required as left operand of assignment
./../common/sim-profile.c: In function 'profile_uninstall':
./../common/sim-profile.c:1299:7: warning: implicit declaration of function 'PROFILE_INSN_COUNT'
./../common/sim-profile.c:1299:37: warning: comparison between pointer and integer
./../common/sim-profile.c:1300:2: warning: passing argument 1 of 'zfree' makes pointer from integer without a cast
../common/sim-utils.h:30:6: note: expected 'void *' but argument is of type 'int'
make[2]: *** [sim-profile.o] Error 1

So add some stubs similar to how some of the other subsystems are
stubbed out so things build correctly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sim/common/ChangeLog
sim/common/sim-profile.c

index 3a6cea4d642102dbb5a46bccc204b305ce3bdbe0..dc6ffef3f6259893fcbe0ec0968c54958768f571 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-22  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-profile.c (PROFILE_PC_FREQ, PROFILE_PC_NR_BUCKETS,
+       PROFILE_PC_SHIFT, PROFILE_PC_START, PROFILE_PC_END,
+       PROFILE_INSN_COUNT): Add stubs when profile is disabled.
+
 2010-11-22  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-core.c (WITH_HW): Add device casts to device_error,
index e7bcd3e3a7df649e6c4684ac0dbc42aaaccf1976..837fada69509cbcbdf551a30f398597dadca8bb6 100644 (file)
@@ -36,6 +36,16 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 #include <ctype.h>
 
+#if !WITH_PROFILE_PC_P
+static unsigned int _profile_stub;
+# define PROFILE_PC_FREQ(p) _profile_stub
+# define PROFILE_PC_NR_BUCKETS(p) _profile_stub
+# define PROFILE_PC_SHIFT(p) _profile_stub
+# define PROFILE_PC_START(p) _profile_stub
+# define PROFILE_PC_END(p) _profile_stub
+# define PROFILE_INSN_COUNT(p) &_profile_stub
+#endif
+
 #define COMMAS(n) sim_add_commas (comma_buf, sizeof (comma_buf), (n))
 
 static MODULE_INIT_FN profile_init;