From 0ca197374ec08d7474621fcd3d380f79b412846b Mon Sep 17 00:00:00 2001 From: Johannes Kliemann Date: Tue, 3 Jul 2018 15:01:07 +0200 Subject: [PATCH] Ada: cleanup sources (license headers, beautify) --- repos/libports/include/ada/exception.h | 39 ++-- .../libports/src/lib/ada/runtime/a-except.adb | 12 ++ .../libports/src/lib/ada/runtime/a-except.ads | 12 ++ .../libports/src/lib/ada/runtime/s-secsta.adb | 12 ++ .../libports/src/lib/ada/runtime/s-secsta.ads | 12 ++ .../src/lib/ada/runtimelib/a-except_c.cc | 175 ++++++++++-------- .../src/lib/ada/runtimelib/a-exctab_c.cc | 22 ++- .../src/lib/ada/runtimelib/s-soflin_c.cc | 62 ++++--- repos/libports/src/test/ada_exception/main.cc | 20 +- 9 files changed, 242 insertions(+), 124 deletions(-) diff --git a/repos/libports/include/ada/exception.h b/repos/libports/include/ada/exception.h index 8d0b9ecf45..e5a7e14109 100644 --- a/repos/libports/include/ada/exception.h +++ b/repos/libports/include/ada/exception.h @@ -1,18 +1,31 @@ +/* + * \brief Ada exception declarations for C++ + * \author Johannes Kliemann + * \date 2018-06-25 + * + */ + +/* + * Copyright (C) 2018 Componolit GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ #include namespace Ada { - namespace Exception { - class Program_Error : Genode::Exception {}; - class Constraint_Error : Genode::Exception {}; - class Storage_Error : Genode::Exception {}; + namespace Exception { + class Program_Error : Genode::Exception {}; + class Constraint_Error : Genode::Exception {}; + class Storage_Error : Genode::Exception {}; - class Length_Check : Constraint_Error {}; - class Overflow_Check : Constraint_Error {}; - class Invalid_Data : Constraint_Error {}; - class Range_Check : Constraint_Error {}; - class Index_Check : Constraint_Error {}; - class Discriminant_Check : Constraint_Error {}; - class Divide_By_Zero : Constraint_Error {}; - }; -}; + class Length_Check : Constraint_Error {}; + class Overflow_Check : Constraint_Error {}; + class Invalid_Data : Constraint_Error {}; + class Range_Check : Constraint_Error {}; + class Index_Check : Constraint_Error {}; + class Discriminant_Check : Constraint_Error {}; + class Divide_By_Zero : Constraint_Error {}; + } +} diff --git a/repos/libports/src/lib/ada/runtime/a-except.adb b/repos/libports/src/lib/ada/runtime/a-except.adb index e60cecf39a..a1bc17b93d 100644 --- a/repos/libports/src/lib/ada/runtime/a-except.adb +++ b/repos/libports/src/lib/ada/runtime/a-except.adb @@ -1,3 +1,15 @@ +-- +-- \brief Ada exceptions +-- \author Johannes Kliemann +-- \date 2018-06-25 +-- +-- Copyright (C) 2018 Genode Labs GmbH +-- Copyright (C) 2018 Componolit GmbH +-- +-- This file is part of the Genode OS framework, which is distributed +-- under the terms of the GNU Affero General Public License version 3. +-- + package body Ada.Exceptions is ---------------------------- diff --git a/repos/libports/src/lib/ada/runtime/a-except.ads b/repos/libports/src/lib/ada/runtime/a-except.ads index 1f183d1a88..893fcaf7c5 100644 --- a/repos/libports/src/lib/ada/runtime/a-except.ads +++ b/repos/libports/src/lib/ada/runtime/a-except.ads @@ -1,3 +1,15 @@ +-- +-- \brief Ada exceptions +-- \author Johannes Kliemann +-- \date 2018-06-25 +-- +-- Copyright (C) 2018 Genode Labs GmbH +-- Copyright (C) 2018 Componolit GmbH +-- +-- This file is part of the Genode OS framework, which is distributed +-- under the terms of the GNU Affero General Public License version 3. +-- + with System; package Ada.Exceptions is diff --git a/repos/libports/src/lib/ada/runtime/s-secsta.adb b/repos/libports/src/lib/ada/runtime/s-secsta.adb index 504834395e..c1d1fb3032 100644 --- a/repos/libports/src/lib/ada/runtime/s-secsta.adb +++ b/repos/libports/src/lib/ada/runtime/s-secsta.adb @@ -1,3 +1,15 @@ +-- +-- \brief Ada secondary stack +-- \author Johannes Kliemann +-- \date 2018-04-16 +-- +-- Copyright (C) 2018 Genode Labs GmbH +-- Copyright (C) 2018 Componolit GmbH +-- +-- This file is part of the Genode OS framework, which is distributed +-- under the terms of the GNU Affero General Public License version 3. +-- + package body System.Secondary_Stack is procedure SS_Allocate ( diff --git a/repos/libports/src/lib/ada/runtime/s-secsta.ads b/repos/libports/src/lib/ada/runtime/s-secsta.ads index c073d7ee42..1ae3ded734 100644 --- a/repos/libports/src/lib/ada/runtime/s-secsta.ads +++ b/repos/libports/src/lib/ada/runtime/s-secsta.ads @@ -1,3 +1,15 @@ +-- +-- \brief Ada secondary stack +-- \author Johannes Kliemann +-- \date 2018-04-16 +-- +-- Copyright (C) 2018 Genode Labs GmbH +-- Copyright (C) 2018 Componolit GmbH +-- +-- This file is part of the Genode OS framework, which is distributed +-- under the terms of the GNU Affero General Public License version 3. +-- + with System.Storage_Elements; with Ss_Utils; use all type Ss_Utils.Thread; diff --git a/repos/libports/src/lib/ada/runtimelib/a-except_c.cc b/repos/libports/src/lib/ada/runtimelib/a-except_c.cc index f32c36c118..79f0d2037a 100644 --- a/repos/libports/src/lib/ada/runtimelib/a-except_c.cc +++ b/repos/libports/src/lib/ada/runtimelib/a-except_c.cc @@ -1,3 +1,18 @@ +/* + * \brief Implementation of Ada exception functions, propagating to C++ + * \author Alexander Senier + * \author Johannes Kliemann + * \date 2018-04-16 + * + */ + +/* + * Copyright (C) 2018 Genode Labs GmbH + * Copyright (C) 2018 Componolit GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ #include #include @@ -5,98 +20,98 @@ extern "C" { - /* Program Error */ - void __gnat_rcheck_PE_Explicit_Raise(char *file, int line) - { - Genode::error("Program Error in ", Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Program_Error(); - } + /* Program Error */ + void __gnat_rcheck_PE_Explicit_Raise(char *file, int line) + { + Genode::error("Program Error in ", Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Program_Error(); + } - /* Constraint Error */ - void constraint_error(char *file, int line) - { - Genode::error("Constraint Error in ", Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Constraint_Error(); - } + /* Constraint Error */ + void constraint_error(char *file, int line) + { + Genode::error("Constraint Error in ", Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Constraint_Error(); + } - void __gnat_rcheck_CE_Explicit_Raise(char *file, int line) - { - constraint_error(file, line); - } + void __gnat_rcheck_CE_Explicit_Raise(char *file, int line) + { + constraint_error(file, line); + } - /* Storage Error */ - void __gnat_rcheck_SE_Explicit_Raise(char *file, int line) - { - Genode::error("Storage Error in ", Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Storage_Error(); - } + /* Storage Error */ + void __gnat_rcheck_SE_Explicit_Raise(char *file, int line) + { + Genode::error("Storage Error in ", Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Storage_Error(); + } - /* Constraint Error subtypes */ + /* Constraint Error subtypes */ - /* Length check failed */ - void __gnat_rcheck_CE_Length_Check(char *file, int line) - { - Genode::error("Constraint Error: Length check failed in ", - Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Length_Check(); - } + /* Length check failed */ + void __gnat_rcheck_CE_Length_Check(char *file, int line) + { + Genode::error("Constraint Error: Length check failed in ", + Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Length_Check(); + } - /* Overflow check failed */ - void __gnat_rcheck_CE_Overflow_Check(char *file, int line) - { - Genode::error("Constraint Error: Overflow check failed in ", - Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Overflow_Check(); - } + /* Overflow check failed */ + void __gnat_rcheck_CE_Overflow_Check(char *file, int line) + { + Genode::error("Constraint Error: Overflow check failed in ", + Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Overflow_Check(); + } - /* Invalid data */ - void __gnat_rcheck_CE_Invalid_Data(char *file, int line) - { - Genode::error("Constraint Error: Invalid data in ", - Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Invalid_Data(); - } + /* Invalid data */ + void __gnat_rcheck_CE_Invalid_Data(char *file, int line) + { + Genode::error("Constraint Error: Invalid data in ", + Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Invalid_Data(); + } - /* Range check failed */ - void __gnat_rcheck_CE_Range_Check(char *file, int line) - { - Genode::error("Constraint Error: Range check failed in ", - Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Range_Check(); - } + /* Range check failed */ + void __gnat_rcheck_CE_Range_Check(char *file, int line) + { + Genode::error("Constraint Error: Range check failed in ", + Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Range_Check(); + } - /* Index check failed */ - void __gnat_rcheck_CE_Index_Check(char *file, int line) - { - Genode::error("Constraint Error: Index check failed in ", - Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Index_Check(); - } + /* Index check failed */ + void __gnat_rcheck_CE_Index_Check(char *file, int line) + { + Genode::error("Constraint Error: Index check failed in ", + Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Index_Check(); + } - /* Discriminant check failed */ - void __gnat_rcheck_CE_Discriminant_Check(char *file, int line) - { - Genode::error("Constraint Error: Discriminant check failed in ", - Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Discriminant_Check(); - } + /* Discriminant check failed */ + void __gnat_rcheck_CE_Discriminant_Check(char *file, int line) + { + Genode::error("Constraint Error: Discriminant check failed in ", + Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Discriminant_Check(); + } - /* Divide by 0 */ - void __gnat_rcheck_CE_Divide_By_Zero (char *file, int line) - { - Genode::error("Constraint Error: Divide by zero in ", - Genode::Cstring(file), " at line ", line); - throw Ada::Exception::Divide_By_Zero(); - } + /* Divide by 0 */ + void __gnat_rcheck_CE_Divide_By_Zero(char *file, int line) + { + Genode::error("Constraint Error: Divide by zero in ", + Genode::Cstring(file), " at line ", line); + throw Ada::Exception::Divide_By_Zero(); + } - void raise_ada_exception(char *name, char *message) - { - Genode::error(Genode::Cstring(name), " raised: ", Genode::Cstring(message)); - } + void raise_ada_exception(char *name, char *message) + { + Genode::error(Genode::Cstring(name), " raised: ", Genode::Cstring(message)); + } - void warn_unimplemented_function(char *func) - { - Genode::warning(Genode::Cstring(func), " unimplemented"); - } + void warn_unimplemented_function(char *func) + { + Genode::warning(Genode::Cstring(func), " unimplemented"); + } } diff --git a/repos/libports/src/lib/ada/runtimelib/a-exctab_c.cc b/repos/libports/src/lib/ada/runtimelib/a-exctab_c.cc index 292caaf1d0..895bbc3bb1 100644 --- a/repos/libports/src/lib/ada/runtimelib/a-exctab_c.cc +++ b/repos/libports/src/lib/ada/runtimelib/a-exctab_c.cc @@ -1,11 +1,25 @@ +/* + * \brief Provide dummy for custom Ada exceptions + * \author Johannes Kliemann + * \date 2018-06-25 + * + */ + +/* + * Copyright (C) 2018 Genode Labs GmbH + * Copyright (C) 2018 Componolit GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ #include extern "C" { - void system__exception_table__register() - { - Genode::warning(__func__, " not implemented"); - } + void system__exception_table__register() + { + Genode::warning(__func__, " not implemented"); + } } diff --git a/repos/libports/src/lib/ada/runtimelib/s-soflin_c.cc b/repos/libports/src/lib/ada/runtimelib/s-soflin_c.cc index 18ecd34631..ecd153a2c2 100644 --- a/repos/libports/src/lib/ada/runtimelib/s-soflin_c.cc +++ b/repos/libports/src/lib/ada/runtimelib/s-soflin_c.cc @@ -1,36 +1,50 @@ +/* + * \brief Dummy implementation for Ada softlinks + * \author Johannes Kliemann + * \date 2018-04-16 + * + */ + +/* + * Copyright (C) 2018 Genode Labs GmbH + * Copyright (C) 2018 Componolit GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ #include extern "C" { - void system__soft_links__get_current_excep() - { - Genode::warning(__func__, " not implemented"); - } + void system__soft_links__get_current_excep() + { + Genode::warning(__func__, " not implemented"); + } - void system__soft_links__get_gnat_exception() - { - Genode::warning(__func__, " not implemented"); - } + void system__soft_links__get_gnat_exception() + { + Genode::warning(__func__, " not implemented"); + } - void system__soft_links__get_jmpbuf_address_soft() - { - Genode::warning(__func__, " not implemented"); - } + void system__soft_links__get_jmpbuf_address_soft() + { + Genode::warning(__func__, " not implemented"); + } - void system__soft_links__set_jmpbuf_address_soft() - { - Genode::warning(__func__, " not implemented"); - } + void system__soft_links__set_jmpbuf_address_soft() + { + Genode::warning(__func__, " not implemented"); + } - void system__soft_links__lock_task() - { - Genode::warning(__func__, " not implemented"); - } + void system__soft_links__lock_task() + { + Genode::warning(__func__, " not implemented"); + } - void system__soft_links__unlock_task() - { - Genode::warning(__func__, " not implemented"); - } + void system__soft_links__unlock_task() + { + Genode::warning(__func__, " not implemented"); + } } diff --git a/repos/libports/src/test/ada_exception/main.cc b/repos/libports/src/test/ada_exception/main.cc index 10543c1b58..6872adb240 100644 --- a/repos/libports/src/test/ada_exception/main.cc +++ b/repos/libports/src/test/ada_exception/main.cc @@ -1,3 +1,17 @@ +/* + * \brief Test Ada exceptions in C++ + * \author Johannes Kliemann + * \date 2018-06-25 + * + */ + +/* + * Copyright (C) 2018 Genode Labs GmbH + * Copyright (C) 2018 Componolit GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ #include #include @@ -6,9 +20,9 @@ extern "C" void except__raise_task(); void Component::construct(Genode::Env &env) { - Genode::log("Ada exception test"); + Genode::log("Ada exception test"); - except__raise_task(); + except__raise_task(); - env.parent().exit(0); + env.parent().exit(0); }