Jump to content

A strange SystemC warning


katang

Recommended Posts

I receive a kind of strange warning: the same runtime warning repeats, next time one character shorter, as long as the length of the path in message lasts. Like the fragment shown below. However, the test runs file. Since in the message only SystemC files are referred to, I have no idea what could be the reason. (Honestly, if it would be the task to program by intention something like this, I would be in serious trouble). Any idea, what and where to look for?

 

The call scMod(/*"My_Name_"+ char(ID+'A')) results in what shown, (0<=ID<= 16)

The call scMod("My_Name_")  runs fine. (scMod is a SystemC module)

Do I something illegal?

 

Warning: (W506) illegal characters: include/sysc/communication/sc_port.h substituted by include/sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264


Warning: (W506) illegal characters: nclude/sysc/communication/sc_port.h substituted by nclude/sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264


Warning: (W506) illegal characters: clude/sysc/communication/sc_port.h substituted by clude/sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264

Starts with

 

Warning: (W506) illegal characters: /usr/local/systemc231a/include/sysc/communication/sc_port.h substituted by /usr/local/systemc231a/include/sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264

ends with

 

Warning: (W506) illegal characters: /sysc/communication/sc_port.h substituted by /sysc/communication/sc_port_h

In file: ../../../../src/sysc/kernel/sc_object.cpp:264

 

Link to comment
Share on other sites

The root for your problem is not in the implementation of SystemC, but in your code. You forgot that in C, you cannot simply concatenate C string (i.e., arrays of type char) by adding them. Instead of concatenating strings the addition of char(ID+'A') to the string "My_Name_" modified the pointer to the string to point ID+65 positions beyond the start of the original string. At that point in memory is probably only garbage, which was interpreted by the sc_object constructor as an object name thus causing the illegal characters warning.

To properly concatenate strings in C, you need to reserve a big enough buffer to hold the concatenated result and then use strcpy(), strcat(), strncpy(), strncat() functions copying / concatenating strings. However, in C++, you can use std::string to simplify your task. The following code should work. Though, it may not be optimal in terms of performance (a std:: string gets temporarily constructed):

scMod((std::string("My_Name_") + char(ID+'A')).c_str())

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...