Re: [PATCH] Address several issues from compiling examples

2019-09-02 Thread Martin Erik Werner
On Tue, 2019-09-03 at 01:48 +0200, Martin Erik Werner wrote:
> Compiling the code from examples "code-block:: c" along with public
> includes and a bsp exposed a few issues amongst a lot of false
> positives. Address some of these:
(...)

As per the sent patch, I've had some "fun" trying to run through code
examples in the documentation and looking at compile warnings.

Amongst the large amount of false positives there were quite a few more
or less significant fixes that came out of it, hopefully.

I used a *very rough* bash+awk script to do filtering and compilation,
I've attached it below if anyone dares to look.

I wonder if it might be interesting to mark a select few (or even
majority?) of the documentation examples as explicitly compilable in
isolation and adding the required include statements to them? It might
make compile-validation significantly easier in the future...

As a side effect of this I've also noticed some things which I'm really
unsure about:

The filesystem section seems very out of date, especially the
filesystem implementation part, where it seems to match the current
rtems state very poorly, I've skipped doing any updates in this section
since there seemed like major changes in both text and examples would
be needed.

With reference to ticket #3254, commit 3f575da2f2 - "Remove obsolete
network header files" removed cpukit/libnetworking/include/net/if.h.
This removed, amongst other things, the definitions for "struct ifreq"
and "struct ifaliasreq". These two are referenced and used both in
rtems-docs and in current code in rtems.

I'm wondering if I'm missing something here? Are they provided through
some other means? Are these supposed to be completely removed and all
use of them removed eventually? Do they need to be re-added for the
current code to work as it should?

-- 
Martin Erik Werner 

compile-examples
Description: Perl program
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] Address several issues from compiling examples

2019-09-02 Thread Chris Johns
On 3/9/19 9:48 am, Martin Erik Werner wrote:
> Compiling the code from examples "code-block:: c" along with public
> includes and a bsp exposed a few issues amongst a lot of false
> positives. Address some of these:

Pushed. Thank you.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] Address several issues from compiling examples

2019-09-02 Thread Martin Erik Werner
Compiling the code from examples "code-block:: c" along with public
includes and a bsp exposed a few issues amongst a lot of false
positives. Address some of these:

* Terminate struct declarations with ';'. Mainly for pedantic
  correctness.

* Show ptrdiff_t instead of size_t for the sbrk() prototype, matching
  the current argument type in rtems.

* Replace some occurrences of unsigned16 with uint16_t.

* Fix odd type declaration, "uint8_t char*" -> "char*".

* Use appropriate helper to get chain head instead of invalid access to
  nonexistent struct member.

* Remove several excess '\' escapes.

* Use RTEMS_SELF instead of undefined SELF.

* Use rtems_task instead of void for task functions.

* Add missing stack size parameter in task creation.

* Use rtems_interrupt_level instead of undefined rtems_interrupt.

* Correct return value format for rtems_object_id_get_api()
  rtems_object_id_get_index() (enum and uint16_t) and also fix
  corresponding print formatting.

* Correct return value documentation for rtems_object_id_get_class(),
  rtems_object_id_get_node() and rtems_object_id_get_index()
  int -> uint32_t.

* Use RTEMS_SUCCESSFUL instead of undefined RTEMS_STATUS_SUCCESSFUL and
  fix return value variable name in rate monotonic examples.

* Use RTEMS_TIMEOUT instead of undefined TIMEOUT and RTEMS_PERIOD_STATUS
  instead of undefined STATUS.

* Add missing fields to ftpd configuration.

* Correct parameter types in ftpd hook prototype,
  unsigned char * -> void *.

* Fix various code-block:: attributes, c -> makefile and c -> shell.

* Add missing parenthesis in socket buffer memory calculation example.

* Remove typedef in declaration of mq_attr since it is defiend without
  typedef in reality.

* Update siginfo_t declaration to match current reality.

* Update shell user command definition example to include mode, uid and
  gid.
---
 bsp-howto/console.rst |  2 +-
 bsp-howto/miscellanous_support.rst|  2 +-
 bsp-howto/real_time_clock.rst |  4 ++--
 c-user/chains.rst |  4 ++--
 c-user/configuring_a_system.rst   |  2 +-
 c-user/constant_bandwidth_server.rst  |  6 +++---
 c-user/fatal_error.rst|  7 ---
 c-user/interrupt_manager.rst  |  8 
 c-user/key_concepts.rst   |  4 ++--
 c-user/object_services.rst| 19 ++-
 c-user/rate_monotonic_manager.rst | 19 +--
 c-user/task_manager.rst   |  2 +-
 networking/network_servers.rst| 10 --
 networking/networking_driver.rst  |  4 ++--
 networking/using_networking_rtems_app.rst |  6 +++---
 posix-users/message_passing.rst   |  2 +-
 posix-users/signal.rst| 16 
 shell/configuration_and_init.rst  | 15 +--
 shell/file_and_directory.rst  |  6 +++---
 shell/general_commands.rst|  2 +-
 20 files changed, 71 insertions(+), 69 deletions(-)

diff --git a/bsp-howto/console.rst b/bsp-howto/console.rst
index 83b10b4..aef13a8 100644
--- a/bsp-howto/console.rst
+++ b/bsp-howto/console.rst
@@ -168,7 +168,7 @@ The handler table for the polled mode should look like the 
following.
   .set_attributes = my_driver_set_attributes,
   .ioctl = my_driver_ioctl, /* optional, may be NULL */
   .mode = TERMIOS_POLLED
-}
+};
 
 The :c:func:`my_driver_poll_write()` routine is responsible for writing ``n``
 characters from ``buf`` to the serial device specified by ``base``.
diff --git a/bsp-howto/miscellanous_support.rst 
b/bsp-howto/miscellanous_support.rst
index cea744d..77b7194 100644
--- a/bsp-howto/miscellanous_support.rst
+++ b/bsp-howto/miscellanous_support.rst
@@ -138,7 +138,7 @@ prototype for this routine:
 
 .. code-block:: c
 
-void * sbrk(size_t increment)
+void * sbrk(ptrdiff_t increment)
 
 The ``increment`` amount is based upon the ``sbrk_amount`` parameter passed to
 the ``bsp_libc_init`` during system initialization.
diff --git a/bsp-howto/real_time_clock.rst b/bsp-howto/real_time_clock.rst
index ee40a6c..62ec09e 100644
--- a/bsp-howto/real_time_clock.rst
+++ b/bsp-howto/real_time_clock.rst
@@ -67,8 +67,8 @@ table is below:
 
 bool dmv177_icm7170_probe(int minor)
 {
-  volatile unsigned16 *card_resource_reg;
-  card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG;
+  volatile uint16_t *card_resource_reg;
+  card_resource_reg = (volatile uint16_t *) DMV170_CARD_RESORCE_REG;
   if ( (*card_resource_reg & DMV170_RTC_INST_MASK) == DMV170_RTC_INSTALLED 
)
 return TRUE;
   return FALSE;
diff --git a/c-user/chains.rst b/c-user/chains.rst
index c47d318..0dce1d9 100644
--- a/c-user/chains.rst
+++ b/c-user/chains.rst
@@ -149,7 +149,7 @@ to the control. Consider a user structure and chain control:
 typedef struct foo
 {
 rtems_chain_node node;
-uint8_t char*